deanishe / alfred-workflow

Full-featured library for writing Alfred 3 & 4 workflows
https://www.deanishe.net/alfred-workflow/
Other
2.97k stars 232 forks source link

"JSON error: Garbage at end. in JSON" when using magic args #134

Closed williamconnolly closed 6 years ago

williamconnolly commented 6 years ago

I think it's likely that this is caused by user error, but its looking like Alfred is being returned duplicate payloads when being used with magic arguments. I'll attach the full output below, but I've searched my script filter for extraneous "wf.send_feedback()" calls and there aren't any. Has anyone seen this error come up before, and if so, what was the root cause? Note: I have been successful using magic args with the same version of workflow, so it's very likely that I'm doing something wrong, at no fault of alfred-workflow.

[ERROR: input.scriptfilter] JSON error: Garbage at end. in JSON: {"items": [{"valid": false, "subtitle": "", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarInfo.icns"}, "title": "wf:autoupdate"}, {"valid": false, "subtitle": "", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarInfo.icns"}, "title": "wf:delcache"}, {"valid": false, "subtitle": "", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarInfo.icns"}, "title": "wf:deldata"}, {"valid": false, "subtitle": "", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarInfo.icns"}, "title": "wf:delsettings"}, {"valid": false, "subtitle": "", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarInfo.icns"}, "title": "wf:foldingdefault"}, {"valid": false, "subtitle": "", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarInfo.icns"}, "title": "wf:foldingoff"}, {"valid": false, "subtitle": "", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarInfo.icns"}, "title": "wf:foldingon"}, {"valid": false, "subtitle": "", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarInfo.icns"}, "title": "wf:help"}, {"valid": false, "subtitle": "", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarInfo.icns"}, "title": "wf:noautoupdate"}, {"valid": false, "subtitle": "", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarInfo.icns"}, "title": "wf:noprereleases"}, {"valid": false, "subtitle": "", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarInfo.icns"}, "title": "wf:opencache"}, {"valid": false, "subtitle": "", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarInfo.icns"}, "title": "wf:opendata"}, {"valid": false, "subtitle": "", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarInfo.icns"}, "title": "wf:openlog"}, {"valid": false, "subtitle": "", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarInfo.icns"}, "title": "wf:openterm"}, {"valid": false, "subtitle": "", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarInfo.icns"}, "title": "wf:openworkflow"}, {"valid": false, "subtitle": "", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarInfo.icns"}, "title": "wf:prereleases"}, {"valid": false, "subtitle": "", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarInfo.icns"}, "title": "wf:reset"}, {"valid": false, "subtitle": "", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarInfo.icns"}, "title": "wf:update"}, {"valid": false, "subtitle": "", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/ToolbarInfo.icns"}, "title": "wf:version"}]}{"items": [{"valid": false, "subtitle": "'unicode' object has no attribute 'startwith'", "icon": {"path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"}, "title": "Error in workflow 'JIRA Issue'"}]}

williamconnolly commented 6 years ago

Looks like a syntax error wormed its way in the output -- using the Console app instead of Alfred helps tremendously. Though it seems that Workflow was failing to capture the exception even when wrapping the main method like the documentation shows.

deanishe commented 6 years ago

Though it seems that Workflow was failing to capture the exception

You can't catch a syntax error. They cause the program to fail to load.