chrisgrieser / alfred-reddit-browser

Browse your favorite subreddits (and hackernews) via Alfred.
MIT License
19 stars 0 forks source link

[Bug]: Error occurred #2

Closed llity closed 6 days ago

llity commented 2 weeks ago

Bug Description

The above error occurs when typing sub and rr

[16:10:50.751] Reddit Browser[Script Filter] Queuing argument '(null)'
[16:10:51.839] Reddit Browser[Script Filter] Script with argv '(null)' finished
[16:10:51.839] ERROR: Reddit Browser[Script Filter] Code 1: /Users/xxx/Library/CloudStorage/OneDrive-Personal/Apps/Alfred/AlfredMacmini/Alfred.alfredpreferences/workflows/user.workflow.4402AA45-A83E-4A8D-8282-C6108D26AB11/scripts/select-subreddit.js: execution error: Error: SyntaxError: JSON Parse error: Unrecognized token '<' (-2700)

Relevant Screenshot

No response

To Reproduce

No response

Debugging Log

[16:10:50.751] Reddit Browser[Script Filter] Queuing argument '(null)'
[16:10:51.839] Reddit Browser[Script Filter] Script with argv '(null)' finished
[16:10:51.839] ERROR: Reddit Browser[Script Filter] Code 1: /Users/xxx/Library/CloudStorage/OneDrive-Personal/Apps/Alfred/AlfredMacmini/Alfred.alfredpreferences/workflows/user.workflow.4402AA45-A83E-4A8D-8282-C6108D26AB11/scripts/select-subreddit.js: execution error: Error: SyntaxError: JSON Parse error: Unrecognized token '<' (-2700)


### Workflow Configuration

![image](https://github.com/user-attachments/assets/a16f44c6-af91-4645-a85d-01f40bc0d90c)

### Checklist

- [X] I have [updated to the latest version](https://github.com/chrisgrieser/alfred-reddit-browser/releases/latest) of this workflow.
- [X] I am using Alfred 5. (Older versions are not supported anymore.)
chrisgrieser commented 2 weeks ago

Could you go to the folder /Users/{your_username}/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/de.chris-grieser.reddit-browser and copy all files that you can find in that folder? (They are only caches, so they do not contain personal info other than which subreddits you have configured for this workflow.)

Afterward, you can try to delete all files in that folder and run sub or rr again.

llity commented 2 weeks ago

I didn't find the de.chris-grieser.reddit-browser cache folder. image

llity commented 2 weeks ago

I used rr to generate a cache folder

[10:45:17.157] ERROR: Reddit Browser[Script Filter] Code 1: Writing new cache for r/mikrotik
/Users/llity/Library/CloudStorage/OneDrive-Personal/Apps/Alfred/AlfredMacmini/Alfred.alfredpreferences/workflows/user.workflow.4402AA45-A83E-4A8D-8282-C6108D26AB11/scripts/browse-subreddit.js: execution error: Error: Error: The command exited with a non-zero status. (35)
chrisgrieser commented 2 weeks ago

I didn't find the de.chris-grieser.reddit-browser cache folder.

I guess that's the problem then. Alfred should normally create this folder for you. It appears your Alfred does not have permission to control Finder. Try enabling this in your system preferences?

Another potential cause for this is if you are on an older Alfred version, where those fodlers are not auto-created.

llity commented 2 weeks ago

The system settings are all correct. I modified select-subreddit.js, and using "sub" can display the list normally, but an error appears when I press enter. image

[20:09:49.100] Reddit Browser[Script Filter] {"items":[{"title":"r/neovim","subtitle":"👥 67 584","arg":"neovim","icon":{"path":"/Users/llity/Library/Application Support/Alfred/Workflow Data/de.chris-grieser.reddit-browser/neovim.png"},"mods":{"cmd":{"arg":"https://www.reddit.com/r/neovim/"}}},{"title":"r/commandline","subtitle":"👥 91 343","arg":"commandline","icon":{"path":"/Users/llity/Library/Application Support/Alfred/Workflow Data/de.chris-grieser.reddit-browser/commandline.png"},"mods":{"cmd":{"arg":"https://www.reddit.com/r/commandline/"}}},{"title":"r/ProgrammerHumor","subtitle":"👥 3 230 683","arg":"ProgrammerHumor","icon":{"path":"/Users/llity/Library/Application Support/Alfred/Workflow Data/de.chris-grieser.reddit-browser/ProgrammerHumor.png"},"mods":{"cmd":{"arg":"https://www.reddit.com/r/ProgrammerHumor/"}}},{"title":"Hackernews","arg":"hackernews","icon":{"path":"hackernews.png"},"mods":{"cmd":{"arg":"https://news.ycombinator.com/"}}}]}
[20:09:57.593] Reddit Browser[Script Filter] Processing complete
[20:09:57.603] Reddit Browser[Script Filter] Passing output 'neovim' to Arg and Vars
[20:09:57.605] Reddit Browser[Arg and Vars] Processing complete
[20:09:57.606] Reddit Browser[Arg and Vars] Passing output '' to Script Filter
[20:09:57.642] Reddit Browser[Script Filter] Queuing argument '(null)'
[20:09:58.500] Reddit Browser[Script Filter] Script with argv '(null)' finished
[20:09:58.506] ERROR: Reddit Browser[Script Filter] Code 1: /Users/llity/Sync/Library/configs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.4402AA45-A83E-4A8D-8282-C6108D26AB11/scripts/browse-subreddit.js: execution error: Error: SyntaxError: JSON Parse error: Unrecognized token '<' (-2700)
chrisgrieser commented 2 weeks ago

I modified select-subreddit.js

you don't think it would be useful to tell me how you modified it?

Anyway, as far as I can tell, it's an Alfred issue, since the required folder is somehow not written by Alfred.

Try creating the folder /Users/{your_username}/Library/Caches/com.runningwithcrayons.Alfred/Workflow Data/de.chris-grieser.reddit-browser manually.

llity commented 6 days ago

I have already created the de.chris-grieser.reddit-browser folder, but still can't use it properly.

debug code

[07:47:01.499] Logging Started...
[07:47:05.363] Reddit Browser[Script Filter] Queuing argument '(null)'
[07:47:09.158] Reddit Browser[Script Filter] Script with argv '(null)' finished
[07:47:09.165] ERROR: Reddit Browser[Script Filter] Code 1: /Users/name/Sync/Library/configs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.852890FC-7C4C-445D-9B7C-0DBF51DF9467/scripts/select-subreddit.js: execution error: Error: SyntaxError: JSON Parse error: Unrecognized token '<' (-2700)
[07:47:31.877] Reddit Browser[Script Filter] Queuing argument '(null)'
[07:47:33.052] Reddit Browser[Script Filter] Queuing argument '(null)'
[07:47:35.546] Reddit Browser[Script Filter] Script with argv '(null)' finished
[07:47:35.551] ERROR: Reddit Browser[Script Filter] Code 1: Writing new cache for r/neovim
/Users/name/Sync/Library/configs/Alfred/Alfred.alfredpreferences/workflows/user.workflow.852890FC-7C4C-445D-9B7C-0DBF51DF9467/scripts/browse-subreddit.js: execution error: Error: SyntaxError: JSON Parse error: Unrecognized token '<' (-2700)
chrisgrieser commented 6 days ago

As I said, with you doing manual modifications of the code (which you shouldn't) and not even mentioning what you did, you are actively making it harder to help you.

Otherwise, it sounds very much like an issue with your local Alfred installation to me, since normally those files should be created. Or you are on an older version of macOS where the network call somehow fails. Version 1.6.8 improves the error messages a bit.

In either case, I am likely not able to do anything on my end.