Skip to content

[Bug]: Navidrome fails to start if a custom tag with a type that can't be split is defined #3790

@tobiashuttinger

Description

@tobiashuttinger

I confirm that:

  • I have searched the existing open AND closed issues to see if an issue already exists for the bug I've encountered
  • I'm using the latest version (your issue may have been fixed already)

Version

0.55.0

Current Behavior

First of all, a massive thank you for the continuous amazing work on Navidrome. This issue is not a big deal, but it might confuse users.

When a custom tag in the config file is defined like so:

Tags.originalrating.Aliases = ["rating"]
Tags.originalrating.Type = "int"
Tags.originalrating.MaxLength = 50
Tags.originalrating.Album = false
Tags.originalrating.Split = ["; ", " / "]

Navidrome fails with

panic: interface conversion: interface {} is model.TagType, not string [recovered]
panic: interface conversion: interface {} is model.TagType, not string

This is because a tag with type int (or probably any other than string) can't be split.

Expected Behavior

Navidrome ignores the invalid config options and starts normally, but logs a descriptive error, why it failed to parse the config option.
Alternatively, the docs could be updated to make clearer that Split must not be defined with tag types other than string.

Steps To Reproduce

  1. Define a custom tag as in the example above.
  2. Restart Navidrome

Environment

- OS: Ubuntu 24.04 LTS
- Browser: 
- Client:

How Navidrome is installed?

Docker

Configuration

Relevant log output

panic: interface conversion: interface {} is model.TagType, not string [recovered]
	panic: interface conversion: interface {} is model.TagType, not string

goroutine 1 [running]:
github.com/navidrome/navidrome/model.init.OnceValues[...].func3.1()
	/usr/local/go/src/sync/oncefunc.go:86 +0x69
panic({0x11abe60?, 0xc0002d2600?})
	/usr/local/go/src/runtime/panic.go:791 +0x132
github.com/navidrome/navidrome/log.(*Hook).Fire(0x344e040, 0xc0001c78f0)
	/workspace/log/redactrus.go:49 +0x405
github.com/sirupsen/logrus.LevelHooks.Fire(0xc000044ff0?, 0x44fb0?, 0xc0001c78f0)
	/go/pkg/mod/github.com/sirupsen/logrus@v1.9.3/hooks.go:28 +0x64
github.com/sirupsen/logrus.(*Entry).fireHooks(0xc0001c78f0)
	/go/pkg/mod/github.com/sirupsen/logrus@v1.9.3/entry.go:280 +0x1fa
github.com/sirupsen/logrus.(*Entry).log(0xc0001c7880, 0x2, {0xc000040c00, 0x2d})
	/go/pkg/mod/github.com/sirupsen/logrus@v1.9.3/entry.go:242 +0x399
github.com/sirupsen/logrus.(*Entry).Log(0xc0001c7880, 0x2, {0xc0000451b8?, 0xc0000451c8?, 0x4820c5?})
	/go/pkg/mod/github.com/sirupsen/logrus@v1.9.3/entry.go:304 +0x48
github.com/navidrome/navidrome/log.log(0x2, {0xc0000452c0, 0x7, 0x7})
	/workspace/log/log.go:203 +0x89
github.com/navidrome/navidrome/log.Error(...)
	/workspace/log/log.go:179
github.com/navidrome/navidrome/model.collectTags(0x12d0881?, 0xc0002d23f0)
	/workspace/model/tag_mappings.go:117 +0x265
github.com/navidrome/navidrome/model.init.func1()
	/workspace/model/tag_mappings.go:96 +0x145
github.com/navidrome/navidrome/model.init.OnceValues[...].func3()
	/usr/local/go/src/sync/oncefunc.go:89 +0xdb
sync.(*Once).doSlow(0xc0000adc00?, 0xc0004abf80?)
	/usr/local/go/src/sync/once.go:76 +0xb4
sync.(*Once).Do(0xc000045890?, 0x427cc5?)
	/usr/local/go/src/sync/once.go:67 +0x19
github.com/navidrome/navidrome/model.init.OnceValues[...].func4()
	/usr/local/go/src/sync/oncefunc.go:94 +0x5b
github.com/navidrome/navidrome/model.TagMappings(...)
	/workspace/model/tag_mappings.go:66
github.com/navidrome/navidrome/model.tagNames()
	/workspace/model/tag_mappings.go:154 +0x45
github.com/navidrome/navidrome/model.init.0.func1()
	/workspace/model/tag_mappings.go:206 +0x59
github.com/navidrome/navidrome/conf.Load(0x0)
	/workspace/conf/configuration.go:314 +0x9e3
github.com/navidrome/navidrome/cmd.preRun()
	/workspace/cmd/root.go:64 +0x51
github.com/navidrome/navidrome/cmd.init.func8(0xc0000ac800?, {0x12d367c?, 0x7?, 0x12cf797?})
	/workspace/cmd/root.go:37 +0xf
github.com/spf13/cobra.(*Command).execute(0x3453840, {0xc0001a4080, 0x0, 0x0})
	/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:993 +0x8dd
github.com/spf13/cobra.(*Command).ExecuteC(0x3453840)
	/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1148 +0x40c
github.com/spf13/cobra.(*Command).Execute(...)
	/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1071
github.com/spf13/cobra.(*Command).ExecuteContext(...)
	/go/pkg/mod/github.com/spf13/cobra@v1.9.1/command.go:1064
github.com/navidrome/navidrome/cmd.Execute()
	/workspace/cmd/root.go:55 +0x1ae
main.main()
	/workspace/main.go:18 +0xf

Anything else?

No response

Code of Conduct

  • I agree to follow Navidrome's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions