Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Discourse] ERROR json: cannot unmarshal object into Go struct field CategoryModel.category_list.categories.subcategory_list.uploaded_logo of type string #57

Open
cmollet opened this issue Feb 17, 2024 · 5 comments
Labels
bug Something isn't working

Comments

@cmollet
Copy link

cmollet commented Feb 17, 2024

Steps to reproduce:

  1. Connect a Discourse system (in my case, discourse.nixos.org )
  2. Attempt to view posts
  3. "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/bubbletea@v0.24.2/tea.go:373
github.com/charmbracelet/bubbletea.(*Program).Run
        github.com/charmbracelet/bubbletea@v0.24.2/tea.go:503
github.com/charmbracelet/bubbletea.(*Program).Start
        github.com/charmbracelet/bubbletea@v0.24.2/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/cobra@v1.7.0/command.go:944
github.com/spf13/cobra.(*Command).ExecuteC
        github.com/spf13/cobra@v1.7.0/command.go:1068
github.com/spf13/cobra.(*Command).Execute
        github.com/spf13/cobra@v1.7.0/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
@mrusme mrusme added the bug Something isn't working label Feb 20, 2024
@mrusme
Copy link
Owner

mrusme commented Feb 20, 2024

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.

@mrusme mrusme closed this as completed in 408cbd2 Feb 20, 2024
@mrusme
Copy link
Owner

mrusme commented Feb 20, 2024

@cmollet if you can, try the latest master branch and report back in case it should still be failing!

@cmollet
Copy link
Author

cmollet commented Feb 23, 2024

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/bubbletea@v0.25.0/tea.go:411
github.com/charmbracelet/bubbletea.(*Program).Run
        /home/cory/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.25.0/tea.go:543
github.com/charmbracelet/bubbletea.(*Program).Start
        /home/cory/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.25.0/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/cobra@v1.7.0/command.go:944
github.com/spf13/cobra.(*Command).ExecuteC
        /home/cory/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068
github.com/spf13/cobra.(*Command).Execute
        /home/cory/go/pkg/mod/github.com/spf13/cobra@v1.7.0/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/bubbletea@v0.25.0/tea.go:411
github.com/charmbracelet/bubbletea.(*Program).Run
        /home/cory/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.25.0/tea.go:543
github.com/charmbracelet/bubbletea.(*Program).Start
        /home/cory/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.25.0/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/cobra@v1.7.0/command.go:944
github.com/spf13/cobra.(*Command).ExecuteC
        /home/cory/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068
github.com/spf13/cobra.(*Command).Execute
        /home/cory/go/pkg/mod/github.com/spf13/cobra@v1.7.0/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/bubbletea@v0.25.0/tea.go:411
github.com/charmbracelet/bubbletea.(*Program).Run
        /home/cory/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.25.0/tea.go:543
github.com/charmbracelet/bubbletea.(*Program).Start
        /home/cory/go/pkg/mod/github.com/charmbracelet/bubbletea@v0.25.0/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/cobra@v1.7.0/command.go:944
github.com/spf13/cobra.(*Command).ExecuteC
        /home/cory/go/pkg/mod/github.com/spf13/cobra@v1.7.0/command.go:1068
github.com/spf13/cobra.(*Command).Execute
        /home/cory/go/pkg/mod/github.com/spf13/cobra@v1.7.0/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

@cmollet
Copy link
Author

cmollet commented Feb 23, 2024

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

@mrusme
Copy link
Owner

mrusme commented Feb 26, 2024

I see, I'll keep this issue open as this needs to be fixed either way. Thank you for reporting!

@mrusme mrusme reopened this Feb 26, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants