sballin/alfred-search-notes-app

Stopped working after MacOS 11.4 upgrade

Closed this issue · 16 comments

To Reproduce

  1. I'm getting the error message described in "Required setup": https://github.com/sballin/alfred-search-notes-app#required-setup'
  2. Step 3 in the instructions doesn't work, as the "Open Anyway" button doesn't appear.

Info

  • macOS version: 11.4
  • Alfred version: 4.0
  • Workflow version: 3.3.0
  • In System Preferences > Security & Privacy > Privacy, there are checkmarks for Accessibility > Alfred 4, Full Disk Access > Alfred 4, Automation > Alfred 4 > Notes, and Automation > Alfred 4 > System Events? Yes
  • What is the output of the debug log when the error occurs?
panic: unable to open database file: operation not permitted

goroutine 1 [running]:
main.PanicOnErr(...)
	github.com/sballin/alfred-search-notes-app/main.go:394
main.main()
	github.com/sballin/alfred-search-notes-app/main.go:407 +0x789
panic: unable to open database file: operation not permitted

goroutine 1 [running]:
main.PanicOnErr(...)
	github.com/sballin/alfred-search-notes-app/main.go:394
main.main()
	github.com/sballin/alfred-search-notes-app/main.go:407 +0x789
panic: unable to open database file: operation not permitted

goroutine 1 [running]:
main.PanicOnErr(...)
	github.com/sballin/alfred-search-notes-app/main.go:394
main.main()
	github.com/sballin/alfred-search-notes-app/main.go:407 +0x789
panic: unable to open database file: operation not permitted

goroutine 1 [running]:
main.PanicOnErr(...)
	github.com/sballin/alfred-search-notes-app/main.go:394
main.main()
	github.com/sballin/alfred-search-notes-app/main.go:407 +0x789
panic: unable to open database file: operation not permitted

goroutine 1 [running]:
main.PanicOnErr(...)
	github.com/sballin/alfred-search-notes-app/main.go:394
main.main()
	github.com/sballin/alfred-search-notes-app/main.go:407 +0x789
panic: unable to open database file: operation not permitted

goroutine 1 [running]:
main.PanicOnErr(...)
	github.com/sballin/alfred-search-notes-app/main.go:394
main.main()
	github.com/sballin/alfred-search-notes-app/main.go:407 +0x789
panic: unable to open database file: operation not permitted

goroutine 1 [running]:
main.PanicOnErr(...)
	github.com/sballin/alfred-search-notes-app/main.go:394
main.main()
	github.com/sballin/alfred-search-notes-app/main.go:407 +0x789
panic: unable to open database file: operation not permitted

goroutine 1 [running]:
main.PanicOnErr(...)
	github.com/sballin/alfred-search-notes-app/main.go:394
main.main()
	github.com/sballin/alfred-search-notes-app/main.go:407 +0x789

Additional context
Add any other context about the problem here.

The popup message suggests the most common problem people have, which is with setup, regardless of the real error. I think your setup is fine, because the error is coming from a line inside the code.

Did you change the file permissions of the executable search_notes? It's inside a directory of the same name in the workflow directory which you can access by right-clicking on the workflow in Alfred and selecting "Open in Finder".

In your terminal, can you tell me the output of

stat -x ~/Library/Group\ Containers/group.com.apple.notes/NoteStore.sqlite

And also (after cding into the workflow directory)

stat -x search_notes/search_notes

I ran into the same problem after upgrading to 11.4.

From the plugin directory, I ran the search I was trying to run from Alfred, namely ./search_notes title NI. It brought back valid search results.

{ "items": [ { "title": "NI Hiring", "subtitle": "NI Hiring", "arg": "x-coredata://34D75F64-A28E-4E94-B9EA-A44B6E3F0EB5/ICNote/p19?NI", "quicklookurl": null }, ...

So I don't think it is actually permissions issue.

(also, THANK YOU for developing this plugin. I use it every day. It's great.)

You're welcome! And thanks for confirming this is a widespread issue. The latest version I've been using has some changes in the binary and it's been working for me on 11.4, so could either of you install the attached and let me know if it works when searching through Alfred?

Search Notes.alfredworkflow.zip

I tried it and still got the same error. Well, slightly different. The offset is different. (+0x644 (new) vs +0x789(old)).

The error for me is:

  1. Open the Alfred bar with ⌘+space.
  2. Type letter n.
  3. Immediate error.

Also, I can confirm that I can still successfully run the script from the command line.

The perms are:
-rwxr-xr-x 1 myuser staff 13478770 May 30 09:27 search_notes/search_notes

Unfortunately, I don't know where to find the "database" referenced by the error log, so I can't look up the perms on it. Either way, it's strange since the script runs fine when run as a script from the command line.

The database is here: ~/Library/Group\ Containers/group.com.apple.notes/NoteStore.sqlite

Would be good to know your permissions on that too.

ls -la ~/Library/Group\ Containers/group.com.apple.notes/NoteStore.sqlite
-rw-r--r--  1 myuser  staff  15757312 Jun  4 01:13 /Users/myuser/Library/Group Containers/group.com.apple.notes/NoteStore.sqlite

I am able to access that sqlite file with sqlite3 and read the tables.

I compiled the project in Golang 1.16 for my M1 Mac, and Alfred still throws up this error (and only this error. not the others depicted in OP's link):
image

I tried replacing the search_notes binary with my own binary that simply writes "Hello World" to stderr. That binary runs fine.

Some tweaking of your search_notes, and I extracted the long SELECT query. I verified I was able to run that query successfully in sqlite3. I also verified that NewLiteDB and NewNotesDB do not generate err values.

Well, I finally figured it out. Alfred didn't have Full Disk Access checked in the Security & Privacy → Privacy pane. Once I check off Full Disk access it worked fine.

I'm not sure either. Maybe 11.4 tightened up the sandbox.

Well, I finally figured it out. Alfred didn't have Full Disk Access checked in the Security & Privacy → Privacy pane. Once I check off Full Disk access it worked fine.

This solved it for me as well, thank you!

And thank you @gitrobert42 for an amazing plugin.

Alfred does have full disk access for me, however the issue still persists.