westerlind / alfred-raindrop-search

Search or add Raindrop.io bookmarks from Alfred
MIT License
253 stars 14 forks source link

I'm getting a `runtime error: index out of range [0] with length 0` after authentication #10

Closed jonathanlaniado closed 3 years ago

jonathanlaniado commented 3 years ago

See screenshot here:

CleanShot 2021-09-14 at 17 21 14@2x
westerlind commented 3 years ago

Hi @jonathanlaniado

I can't reproduce this, so I will need your help to get more information about what's happening.

Could you open the Alfred preferences, go to Workflows, and click the bug icon in the top right corner to show the debug console, and then do what gave you this error again, and copy what you got in the console and send that?

jonathanlaniado commented 3 years ago

Hmm one thing I can identify is Line 3 here, where the argument appears to be null.

I also notice it's referencing your user account (/Users/andreas/) several times. Is that typical?

Anything else I may be missing?

[17:34:08.866] Logging Started...
[17:34:42.457] Search Raindrop.io[Script Filter] Queuing argument 'syncthing'
[17:34:50.580] Search Raindrop.io[Script Filter] Script with argv '(null)' finished
[17:34:50.581] ERROR: Search Raindrop.io[Script Filter] Code 1: 🍺
17:34:42 workflow.go:328: ----- Search Raindrop.io/2.0.3 (AwGo/0.27.1) -----
17:34:50 workflow.go:343: ------------------ FATAL ERROR -------------------
17:34:50 workflow.go:344: runtime error: index out of range [0] with length 0 : goroutine 1 [running]:
runtime/debug.Stack()
    /opt/homebrew/Cellar/go/1.17/libexec/src/runtime/debug/stack.go:24 +0x65
github.com/deanishe/awgo.(*Workflow).Run.func2()
    /Users/andreas/go/pkg/mod/github.com/deanishe/awgo@v0.29.0/workflow.go:344 +0xd9
panic({0x12eb420, 0xc0002a25b8})
    /opt/homebrew/Cellar/go/1.17/libexec/src/runtime/panic.go:1038 +0x215
main.render_collections({0xc000280300, 0x0, 0x4}, {0xc0004a0000, 0xc, 0xc}, {0x1307c36, 0xc0001acd89}, {0x130b062, 0x9}, ...)
    /Users/andreas/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.1B8F238D-BB91-410E-8CE1-61AD0823A468/raindrop_common.go:362 +0x1d8c
main.search({0x130a6fb, 0x130713c}, {0x7ffeefbff859, 0x9}, {0x0, 0x1d}, {0x0, 0x13d4805}, 0x46, 0x1)
    /Users/andreas/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.1B8F238D-BB91-410E-8CE1-61AD0823A468/raindrop_search.go:115 +0x19e5
main.run()
    /Users/andreas/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.1B8F238D-BB91-410E-8CE1-61AD0823A468/raindrop_main.go:52 +0x765
github.com/deanishe/awgo.(*Workflow).Run(0xc0001567e0, 0x1327140)
    /Users/andreas/go/pkg/mod/github.com/deanishe/awgo@v0.29.0/workflow.go:358 +0x303
main.main()
    /Users/andreas/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.1B8F238D-BB91-410E-8CE1-61AD0823A468/raindrop_main.go:86 +0x1da
17:34:50 workflow.go:345: ---------------- END STACK TRACE -----------------
17:34:50 feedback.go:509: Sent 1 result(s) to Alfred
17:34:50 workflow.go:376: [ERROR] runtime error: index out of range [0] with length 0
17:34:50 workflow.go:402: ------------------ 7.615864582s ------------------
[17:34:50.620] Search Raindrop.io[Script Filter] {
  "variables": {
    "AW_SESSION_ID": "RRDOC3BFDB2NOHYRZ4JOURAW"
  },
  "items": [
    {
      "title": "runtime error: index out of range [0] with length 0",
      "valid": false,
      "icon": {
        "path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns"
      }
    }
  ]
}
westerlind commented 3 years ago

Thanks!

Which version of Alfred are you using?

It's referencing the paths where these files where when they where compiled on my computer (it's not anything it tries to find on your computer), so that in itself should not be a problem.

I will look more into it and try to find a solution. Probably tomorrow.

Thanks for reporting this!

jonathanlaniado commented 3 years ago

Thanks, appreciate it. Looks like 4.5.1!

vladstudio commented 3 years ago

Hey! Same problem here.

[11:44:11.980] Logging Started... [11:44:14.252] Search Raindrop.io[Script Filter] Queuing argument 'win' [11:44:15.044] Search Raindrop.io[Script Filter] Script with argv '(null)' finished [11:44:15.049] ERROR: Search Raindrop.io[Script Filter] Code 1: 🍺 11:44:14 workflow.go:328: ----- Search Raindrop.io/2.0.3 (AwGo/0.27.1) ----- 11:44:15 workflow.go:343: ------------------ FATAL ERROR ------------------- 11:44:15 workflow.go:344: runtime error: index out of range [0] with length 0 : goroutine 1 [running]: runtime/debug.Stack() /opt/homebrew/Cellar/go/1.17/libexec/src/runtime/debug/stack.go:24 +0x88 github.com/deanishe/awgo.(Workflow).Run.func2(0x140001566c0) /Users/andreas/go/pkg/mod/github.com/deanishe/awgo@v0.29.0/workflow.go:344 +0xf0 panic({0x103312bc0, 0x1400015ed68}) /opt/homebrew/Cellar/go/1.17/libexec/src/runtime/panic.go:1038 +0x21c main.render_collections({0x14000386000, 0xe, 0xe}, {0x140001bc180, 0x17, 0x17}, {0x10323f8f0, 0x5}, {0x103242d7b, 0x9}, ...) /Users/andreas/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.1B8F238D-BB91-410E-8CE1-61AD0823A468/raindrop_common.go:362 +0x1e4c main.search({0x1032423fa, 0x8}, {0x16ce37811, 0x3}, {0x0, 0x0}, {0x0, 0x0}, 0x0, 0x1) /Users/andreas/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.1B8F238D-BB91-410E-8CE1-61AD0823A468/raindrop_search.go:115 +0x1ab4 main.run() /Users/andreas/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.1B8F238D-BB91-410E-8CE1-61AD0823A468/raindrop_main.go:52 +0x8b0 github.com/deanishe/awgo.(Workflow).Run(0x140001566c0, 0x10332e820) /Users/andreas/go/pkg/mod/github.com/deanishe/awgo@v0.29.0/workflow.go:358 +0x310 main.main() /Users/andreas/Library/Application Support/Alfred/Alfred.alfredpreferences/workflows/user.workflow.1B8F238D-BB91-410E-8CE1-61AD0823A468/raindrop_main.go:86 +0x258 11:44:15 workflow.go:345: ---------------- END STACK TRACE ----------------- 11:44:15 feedback.go:509: Sent 1 result(s) to Alfred 11:44:15 workflow.go:376: [ERROR] runtime error: index out of range [0] with length 0 11:44:15 workflow.go:402: ------------------ 628.732917ms ------------------ [11:44:15.085] Search Raindrop.io[Script Filter] { "variables": { "AW_SESSION_ID": "ZUGUJ79BWKKPGT9VF6827LPU" }, "items": [ { "title": "runtime error: index out of range [0] with length 0", "valid": false, "icon": { "path": "/System/Library/CoreServices/CoreTypes.bundle/Contents/Resources/AlertStopIcon.icns" } } ] }

vladstudio commented 3 years ago

(forgot to add – MacBook Air M1, latest Alfred, 4.5.1)

westerlind commented 3 years ago

Thanks for reporting @vladstudio

I have an M1 MacBook Air too, so it should work there for sure. I'll look more into it later today, and will probably be able to fix it.

westerlind commented 3 years ago

Hi @vladstudio and @jonathanlaniado

I have figured out what the problem was!

It turns out that all my own collections in Raindrop have manually set icons on them, so I had missed that my check for if there was an icon set or not wasn't functioning properly, so if you had at least one collection that you had not set an icon for (which would have the generic folder icon), you would get this error.

I have released an updated version (2.0.4) that fixes this.

jonathanlaniado commented 3 years ago

Fantastic, Andreas, that fixed it for me. Awesome work pinpointing the issue and thanks for the speedy help!