neonmodem
neonmodem copied to clipboard
[Discourse] ERROR json: cannot unmarshal object into Go struct field CategoryModel.category_list.categories.subcategory_list.uploaded_logo of type string
Steps to reproduce:
- Connect a Discourse system (in my case, discourse.nixos.org )
- Attempt to view posts
- "No items found" displays on UI; error log gives
2024-02-17T15:10:04.768-0600 DEBUG ui/ui.go:328 generating UI viewcache
2024-02-17T15:10:05.809-0600 DEBUG api/client.go:55 [DEBUG] %s %s[GET https://discourse.nixos.org/categories.json?include_subcategories=true]
2024-02-17T15:10:05.998-0600 ERROR ui/ui.go:147 json: cannot unmarshal object into Go struct field CategoryModel.category_list.categories.subcategory_list.uploaded_logo of type string
github.com/mrusme/neonmodem/ui.Model.Update
github.com/mrusme/neonmodem/ui/ui.go:147
github.com/charmbracelet/bubbletea.(*Program).eventLoop
github.com/charmbracelet/[email protected]/tea.go:373
github.com/charmbracelet/bubbletea.(*Program).Run
github.com/charmbracelet/[email protected]/tea.go:503
github.com/charmbracelet/bubbletea.(*Program).Start
github.com/charmbracelet/[email protected]/tea.go:548
github.com/mrusme/neonmodem/cmd.init.func1
github.com/mrusme/neonmodem/cmd/root.go:132
github.com/spf13/cobra.(*Command).execute
github.com/spf13/[email protected]/command.go:944
github.com/spf13/cobra.(*Command).ExecuteC
github.com/spf13/[email protected]/command.go:1068
github.com/spf13/cobra.(*Command).Execute
github.com/spf13/[email protected]/command.go:992
github.com/mrusme/neonmodem/cmd.Execute
github.com/mrusme/neonmodem/cmd/root.go:141
main.main
github.com/mrusme/neonmodem/neonmodem.go:13
runtime.main
runtime/proc.go:271
The API responds with uploaded_logo
set to null
: https://discourse.nixos.org/categories.json?include_subcategories=true
Neon Modem expects it to be a string though. The official API doc says string or null, hence will need to adjust the parsing in Neon Modem.
@cmollet if you can, try the latest master branch and report back in case it should still be failing!
Thanks, @mrusme , unfortunately it seems the issue still persists. Running the neonmodern
binary resulting from running make
on commit hash 408cbd2 gives
2024-02-22T21:04:26.829-0600 DEBUG api/client.go:55 [DEBUG] %s %s[GET https://forum.syncthing.net/categories.json?include_subcategories=true]
2024-02-22T21:04:26.993-0600 DEBUG discourse/discourse.go:143 recursing categories: 8
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:145 adding category: Announce
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:143 recursing categories: 3
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:145 adding category: Release
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:143 recursing categories: 0
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:145 adding category: Talks
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:143 recursing categories: 0
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:145 adding category: Pre-release
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:143 recursing categories: 0
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:145 adding category: Feature
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:143 recursing categories: 0
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:145 adding category: Howto
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:143 recursing categories: 0
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:145 adding category: Support
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:143 recursing categories: 1
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:145 adding category: Android
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:143 recursing categories: 0
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:145 adding category: Development
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:143 recursing categories: 1
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:145 adding category: UX
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:143 recursing categories: 0
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:145 adding category: User Stories
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:143 recursing categories: 0
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:145 adding category: General
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:143 recursing categories: 0
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:145 adding category: Meta
2024-02-22T21:04:26.994-0600 DEBUG discourse/discourse.go:143 recursing categories: 0
2024-02-22T21:04:26.994-0600 ERROR ui/ui.go:147 json: cannot unmarshal object into Go struct field CategoryModel.category_list.categories.subcategory_list.uploaded_logo of type string
github.com/mrusme/neonmodem/ui.Model.Update
/home/cory/projects/github.com/mrusme/neonmodem/ui/ui.go:147
github.com/charmbracelet/bubbletea.(*Program).eventLoop
/home/cory/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:411
github.com/charmbracelet/bubbletea.(*Program).Run
/home/cory/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:543
github.com/charmbracelet/bubbletea.(*Program).Start
/home/cory/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:588
github.com/mrusme/neonmodem/cmd.init.func1
/home/cory/projects/github.com/mrusme/neonmodem/cmd/root.go:132
github.com/spf13/cobra.(*Command).execute
/home/cory/go/pkg/mod/github.com/spf13/[email protected]/command.go:944
github.com/spf13/cobra.(*Command).ExecuteC
/home/cory/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068
github.com/spf13/cobra.(*Command).Execute
/home/cory/go/pkg/mod/github.com/spf13/[email protected]/command.go:992
github.com/mrusme/neonmodem/cmd.Execute
/home/cory/projects/github.com/mrusme/neonmodem/cmd/root.go:141
main.main
/home/cory/projects/github.com/mrusme/neonmodem/neonmodem.go:13
runtime.main
/usr/lib/go/src/runtime/proc.go:271
2024-02-22T21:04:26.994-0600 ERROR ui/ui.go:147 json: cannot unmarshal object into Go struct field CategoryModel.category_list.categories.subcategory_list.uploaded_logo of type string
github.com/mrusme/neonmodem/ui.Model.Update
/home/cory/projects/github.com/mrusme/neonmodem/ui/ui.go:147
github.com/charmbracelet/bubbletea.(*Program).eventLoop
/home/cory/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:411
github.com/charmbracelet/bubbletea.(*Program).Run
/home/cory/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:543
github.com/charmbracelet/bubbletea.(*Program).Start
/home/cory/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:588
github.com/mrusme/neonmodem/cmd.init.func1
/home/cory/projects/github.com/mrusme/neonmodem/cmd/root.go:132
github.com/spf13/cobra.(*Command).execute
/home/cory/go/pkg/mod/github.com/spf13/[email protected]/command.go:944
github.com/spf13/cobra.(*Command).ExecuteC
/home/cory/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068
github.com/spf13/cobra.(*Command).Execute
/home/cory/go/pkg/mod/github.com/spf13/[email protected]/command.go:992
github.com/mrusme/neonmodem/cmd.Execute
/home/cory/projects/github.com/mrusme/neonmodem/cmd/root.go:141
main.main
/home/cory/projects/github.com/mrusme/neonmodem/neonmodem.go:13
runtime.main
/usr/lib/go/src/runtime/proc.go:271
2024-02-22T21:04:26.994-0600 ERROR ui/ui.go:147 json: cannot unmarshal object into Go struct field CategoryModel.category_list.categories.uploaded_logo of type string
github.com/mrusme/neonmodem/ui.Model.Update
/home/cory/projects/github.com/mrusme/neonmodem/ui/ui.go:147
github.com/charmbracelet/bubbletea.(*Program).eventLoop
/home/cory/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:411
github.com/charmbracelet/bubbletea.(*Program).Run
/home/cory/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:543
github.com/charmbracelet/bubbletea.(*Program).Start
/home/cory/go/pkg/mod/github.com/charmbracelet/[email protected]/tea.go:588
github.com/mrusme/neonmodem/cmd.init.func1
/home/cory/projects/github.com/mrusme/neonmodem/cmd/root.go:132
github.com/spf13/cobra.(*Command).execute
/home/cory/go/pkg/mod/github.com/spf13/[email protected]/command.go:944
github.com/spf13/cobra.(*Command).ExecuteC
/home/cory/go/pkg/mod/github.com/spf13/[email protected]/command.go:1068
github.com/spf13/cobra.(*Command).Execute
/home/cory/go/pkg/mod/github.com/spf13/[email protected]/command.go:992
github.com/mrusme/neonmodem/cmd.Execute
/home/cory/projects/github.com/mrusme/neonmodem/cmd/root.go:141
main.main
/home/cory/projects/github.com/mrusme/neonmodem/neonmodem.go:13
runtime.main
/usr/lib/go/src/runtime/proc.go:271
FWIW, I just removed
UploadedLogo
UploadedLogoDark
UploadedBackground
from the CategoryModel
and that did the trick, because I don't think those fields are actually being used at the moment
I see, I'll keep this issue open as this needs to be fixed either way. Thank you for reporting!