Navidrome: panic: runtime error: slice bounds out of range [:3] with capacity 1

Created on 23 Oct 2020  Â·  9Comments  Â·  Source: deluan/navidrome

Version: 0.36.1

Description:
When starting, navidrome crashes while scanning the music library. It is running in Docker on a Raspberry Pi 4, Music directory is a cifs-mount to a Synology NAS.
I've already tested complete new Docker setups both on the Raspberry Pi 4 and a Raspberry Pi 3, Same result.

Log output:

navidrome    | | . ` |/ _` \ \ / / |/ _` | '__/ _ \| '_ ` _ \ / _ \
navidrome    | | |\  | (_| |\ V /| | (_| | | | (_) | | | | | |  __/
navidrome    | \_| \_/\__,_| \_/ |_|\__,_|_|  \___/|_| |_| |_|\___|
navidrome    |                            Version: 0.36.1 (4514a54)
navidrome    | 
navidrome    | 2020/10/23 21:08:56 goose: no migrations to run. current version: 20201021135455
navidrome    | panic: runtime error: slice bounds out of range [:3] with capacity 1
navidrome    | 
navidrome    | goroutine 39 [running]:
navidrome    | github.com/dhowden/tag.readTextWithDescrFrame(0x2789a58, 0x2, 0x2, 0x101, 0x193ab88, 0x0, 0x0)
navidrome    |  /go/pkg/mod/github.com/wader/[email protected]/id3v2frames.go:460 +0x36c
navidrome    | github.com/dhowden/tag.readID3v2Frames(0xa56388, 0x2787098, 0x4e, 0x24a7010, 0x2787098, 0x0, 0x0)
navidrome    |  /go/pkg/mod/github.com/wader/[email protected]/id3v2.go:364 +0x77c
navidrome    | github.com/dhowden/tag.ReadID3v2Tags(0xa59238, 0x2787098, 0xffffffff, 0x1, 0x0, 0x0)
navidrome    |  /go/pkg/mod/github.com/wader/[email protected]/id3v2.go:428 +0xac
navidrome    | github.com/dhowden/tag.ReadFrom(0xa59238, 0x2787098, 0x0, 0x0, 0x2787098, 0x0)
navidrome    |  /go/pkg/mod/github.com/wader/[email protected]/tag.go:52 +0x30c
navidrome    | github.com/deluan/navidrome/scanner/metadata.hasEmbeddedImage(0x281f770, 0x47, 0x2582b00)
navidrome    |  /github/workspace/scanner/metadata/taglib.go:69 +0x128
navidrome    | github.com/deluan/navidrome/scanner/metadata.(*taglibExtractor).extractMetadata(0x1939f2c, 0x281f770, 0x47, 0x3b, 0x28689f0, 0x0)
navidrome    |  /github/workspace/scanner/metadata/taglib.go:57 +0x268
navidrome    | github.com/deluan/navidrome/scanner/metadata.(*taglibExtractor).Extract(0x1939f2c, 0x24b6880, 0xb, 0x10, 0x1, 0x17, 0x1)
navidrome    |  /github/workspace/scanner/metadata/taglib.go:35 +0x6c
navidrome    | github.com/deluan/navidrome/scanner/metadata.Extract(0x24b6880, 0xb, 0x10, 0x1, 0x2410001, 0x0)
navidrome    |  /github/workspace/scanner/metadata/metadata.go:34 +0x9c
navidrome    | github.com/deluan/navidrome/scanner.(*TagScanner).loadTracks(0x26d3480, 0x24b6880, 0xb, 0x10, 0x24a6fc0, 0x1, 0x1, 0x18, 0x313c8)
navidrome    |  /github/workspace/scanner/tag_scanner.go:343 +0x30
navidrome    | github.com/deluan/navidrome/scanner.(*TagScanner).addOrUpdateTracksInDB(0x26d3480, 0xa5beb8, 0x240ece0, 0x25207b0, 0x27, 0x2870fb8, 0x24b6880, 0xb, 0x10, 0x2870f84, ...)
navidrome    |  /github/workspace/scanner/tag_scanner.go:318 +0x354
navidrome    | github.com/deluan/navidrome/scanner.(*TagScanner).processChangedDir(0x26d3480, 0xa5beb8, 0x240ece0, 0x25207b0, 0x27, 0x0, 0x0)
navidrome    |  /github/workspace/scanner/tag_scanner.go:275 +0x9d8
navidrome    | github.com/deluan/navidrome/scanner.(*TagScanner).Scan(0x26d3480, 0xa5beb8, 0x240e6c0, 0xdd40a00, 0x0, 0xd725242b, 0xe, 0x1922690, 0x30d0c, 0xa4c6bb68)
navidrome    |  /github/workspace/scanner/tag_scanner.go:101 +0x388
navidrome    | github.com/deluan/navidrome/scanner.(*Scanner).Rescan(0x26cc390, 0x240c06f, 0x6, 0x0, 0x0, 0x0)
navidrome    |  /github/workspace/scanner/scanner.go:37 +0x13c
navidrome    | github.com/deluan/navidrome/scanner.(*Scanner).RescanAll(0x26cc390, 0x0, 0x0, 0x0)
navidrome    |  /github/workspace/scanner/scanner.go:49 +0x8c
navidrome    | github.com/deluan/navidrome/server.(*Server).initScanner.func1(0x26cc3d0, 0xb2c97000, 0x8b)
navidrome    |  /github/workspace/server/server.go:86 +0x54
navidrome    | created by github.com/deluan/navidrome/server.(*Server).initScanner
navidrome    |  /github/workspace/server/server.go:83 +0x15c
navidrome exited with code 2

Most helpful comment

This happens when I use the dhowden/tag to detect embedded images. While we wait for an answer from the upstream library, I changed the code to detect such errors and recover from the panic, assuming the track does not have an embedded cover and showing only the line bellow in the logs:

ERRO[0072] Panic while checking for images. Please report this error with a copy of the file  error="runtime error: slice bounds out of range [:3] with capacity 1" path="/Users/deluan/Music/Music/Media/_/03 - Semblance Of Confusion - defect.mp3"

All 9 comments

Is this the full log? Is there any other lines between goose: no migrations to run and the panic: runtime error: slice bounds out of range? Are you upgrading or is this the first installation?

Anyway, it seems that there is a file in your library that's is giving a hard time to the upstream https://github.com/dhowden/tag library.

Can you set loglevel to trace, drop any files in your /data folder and start again? If it fails, please send me the full logs (can be by email: deluan AT navidrome DOT org) If you figure out which file is it, based on the logs, please send me the file so I can take a look here.

Thanks!

Agree that it's the library parsing the tags. Here's an embarrassing example of something I have from 20 years ago. Was able to fix and move past just by using id3v2 --convert /path/to/file.mp3

navidrome_1  | time="2020-10-24T06:45:51Z" level=trace msg="TagLib: read tags" filename="/music/singles/Bud Light/Bud Light - Real Men of Genius - Mr. Dishonest Cable TV Hooker Upper.mp3" id=89 tags="map[_album:Commercial _artist:Bud Light _genre:Sound Clip _title:Mr. Dishonest Cable TV Hooker Upper album:Commercial artist:Bud Light bitrate:128 comm: comment: date:0 filetype:audio/mp3 genre:Sound Clip geob:[binary] \"RealJukebox:Metadata\" length:61 talb:Commercial tcom: tcon:Sound Clip tcop: tdrc:0 tenc: tflt:audio/mp3 tit2:Mr. Dishonest Cable TV Hooker Upper title:Mr. Dishonest Cable TV Hooker Upper tope: tpe1:Bud Light trck: url: url:track:web page: wxxx:[Track:Web Page]]"
navidrome_1  | panic: runtime error: slice bounds out of range [:3] with capacity 1
navidrome_1  |
navidrome_1  | goroutine 39 [running]:
navidrome_1  | github.com/dhowden/tag.readTextWithDescrFrame(0xc0001e5490, 0x2, 0x2, 0x101, 0x2252f80, 0xf3f100, 0x1)
navidrome_1  |  /go/pkg/mod/github.com/wader/[email protected]/id3v2frames.go:460 +0x475
navidrome_1  | github.com/dhowden/tag.readID3v2Frames(0x1019860, 0xc0000b4400, 0x8c5, 0xc000011560, 0xc0000b4400, 0x0, 0x0)
navidrome_1  |  /go/pkg/mod/github.com/wader/[email protected]/id3v2.go:364 +0x925
navidrome_1  | github.com/dhowden/tag.ReadID3v2Tags(0x1022da0, 0xc0000b4400, 0x1, 0x0, 0x0, 0x0)
navidrome_1  |  /go/pkg/mod/github.com/wader/[email protected]/id3v2.go:428 +0xe5
navidrome_1  | github.com/dhowden/tag.ReadFrom(0x1022da0, 0xc0000b4400, 0x0, 0xc000000000, 0xc0000b4400, 0x0)
navidrome_1  |  /go/pkg/mod/github.com/wader/[email protected]/tag.go:52 +0x333
navidrome_1  | github.com/deluan/navidrome/scanner/metadata.hasEmbeddedImage(0xc000420700, 0x70, 0xc000363100)
navidrome_1  |  /github/workspace/scanner/metadata/taglib.go:69 +0x19c
navidrome_1  | github.com/deluan/navidrome/scanner/metadata.(*taglibExtractor).extractMetadata(0x2251e20, 0xc000420700, 0x70, 0x67, 0xc0003686f8, 0x0)
navidrome_1  |  /github/workspace/scanner/metadata/taglib.go:57 +0x353
navidrome_1  | github.com/deluan/navidrome/scanner/metadata.(*taglibExtractor).Extract(0x2251e20, 0xc0002ad000, 0x5c, 0x80, 0x765460, 0xc0000b62a0, 0xc000330a10)
navidrome_1  |  /github/workspace/scanner/metadata/taglib.go:35 +0x85
navidrome_1  | github.com/deluan/navidrome/scanner/metadata.Extract(0xc0002ad000, 0x5c, 0x80, 0xc00053d4c8, 0x0, 0x0)
navidrome_1  |  /github/workspace/scanner/metadata/metadata.go:34 +0x9a
navidrome_1  | github.com/deluan/navidrome/scanner.(*TagScanner).loadTracks(0xc0003cac40, 0xc0002ad000, 0x5c, 0x80, 0xc0003522c0, 0x1, 0x1, 0xc00055e728, 0x2)
navidrome_1  |  /github/workspace/scanner/tag_scanner.go:343 +0x5d
navidrome_1  | github.com/deluan/navidrome/scanner.(*TagScanner).addOrUpdateTracksInDB(0xc0003cac40, 0x102afa0, 0xc000315800, 0xc00058b440, 0x27, 0xc00053e288, 0xc0002ad000, 0x5c, 0x80, 0xc00053e2b8, ...)
navidrome_1  |  /github/workspace/scanner/tag_scanner.go:318 +0x537
navidrome_1  | github.com/deluan/navidrome/scanner.(*TagScanner).processChangedDir(0xc0003cac40, 0x102afa0, 0xc000315800, 0xc00058b440, 0x27, 0x0, 0x0)
navidrome_1  |  /github/workspace/scanner/tag_scanner.go:275 +0xf1c
navidrome_1  | github.com/deluan/navidrome/scanner.(*TagScanner).Scan(0xc0003cac40, 0x102afa0, 0xc000314cc0, 0x0, 0x0, 0x0, 0xc000314cc0, 0x0)
navidrome_1  |  /github/workspace/scanner/tag_scanner.go:101 +0x4e5
navidrome_1  | github.com/deluan/navidrome/scanner.(*Scanner).Rescan(0xc0003c8160, 0xc00000c04f, 0x6, 0x0, 0x0, 0x0)
navidrome_1  |  /github/workspace/scanner/scanner.go:37 +0x1f8
navidrome_1  | github.com/deluan/navidrome/scanner.(*Scanner).RescanAll(0xc0003c8160, 0x0, 0x0, 0x0)
navidrome_1  |  /github/workspace/scanner/scanner.go:49 +0xcf
navidrome_1  | github.com/deluan/navidrome/server.(*Server).initScanner.func1(0xc0003c8220, 0xdf8475800)
navidrome_1  |  /github/workspace/server/server.go:86 +0x5e
navidrome_1  | created by github.com/deluan/navidrome/server.(*Server).initScanner
navidrome_1  |  /github/workspace/server/server.go:83 +0x188

here's the id3v2 tags before conversion:

➜  navidrome id3v2 -l '/music/singles/Bud Light/Bud Light - Real Men of Genius - Mr. Dishonest Cable TV Hooker Upper.mp3'
id3v1 tag info for /music/singles/Bud Light/Bud Light - Real Men of Genius - Mr. Dishonest Cable TV Hooker Upper.mp3:
Title  :                                 Artist: Bud Light
Album  : Commercial                      Year:     , Genre: Other (12)
Comment:                                 Track: 0
id3v2 tag info for /music/singles/Bud Light/Bud Light - Real Men of Genius - Mr. Dishonest Cable TV Hooker Upper.mp3:
GEOB (General encapsulated object): (RealJukebox:Metadata)[]: binary, 2041 bytes
WXXX (User defined URL link): (Track:Web Page):
COMM (Comments): (Track:Comments)[eng]:
TFLT (File type): audio/mp3
TRCK (Track number/Position in set):
TENC (Encoded by):
WXXX (User defined URL link): ():
TCOP (Copyright message):
TOPE (Original artist(s)/performer(s)):
TCOM (Composer):
COMM (Comments): ()[]:

I ran a convert
id3v2 --convert '/home/data/music/singles/Bud Light/Bud Light - Real Men of Genius - Mr. Dishonest Cable TV Hooker Upper.mp3', and here are the tags after conversion:

➜  navidrome id3v2 -l '/music/singles/Bud Light/Bud Light - Real Men of Genius - Mr. Dishonest Cable TV Hooker Upper.mp3'
id3v1 tag info for /music/singles/Bud Light/Bud Light - Real Men of Genius - Mr. Dishonest Cable TV Hooker Upper.mp3:
Title  :                                 Artist: Bud Light
Album  : Commercial                      Year:     , Genre: Other (12)
Comment:                                 Track: 0
id3v2 tag info for/music/singles/Bud Light/Bud Light - Real Men of Genius - Mr. Dishonest Cable TV Hooker Upper.mp3:
GEOB (General encapsulated object): (RealJukebox:Metadata)[]: binary, 2041 bytes
WXXX (User defined URL link): (Track:Web Page):
COMM (Comments): (Track:Comments)[eng]:
TFLT (File type): audio/mp3
TRCK (Track number/Position in set):
TENC (Encoded by):
WXXX (User defined URL link): ():
TCOP (Copyright message):
TOPE (Original artist(s)/performer(s)):
COMM (Comments): ()[]:
TPE1 (Lead performer(s)/Soloist(s)): Bud Light
TALB (Album/Movie/Show title): Commercial
TCON (Content type): Other (12)

Glad that you were able to move past this. Don't you have the original file anymore? I'd like to take a look and fill any reproducible issues with the upstream library.

Is this the full log? Is there any other lines between goose: no migrations to run and the panic: runtime error: slice bounds out of range? Are you upgrading or is this the first installation?

It is the full log. The error apparently occurred after the upgrade from 0.36 to 0.36.1, but even after a complete new setup navidrome didn't start

Anyway, it seems that there is a file in your library that's is giving a hard time to the upstream https://github.com/dhowden/tag library.

Can you set loglevel to trace, drop any files in your /data folder and start again? If it fails, please send me the full logs (can be by email: deluan AT navidrome DOT org) If you figure out which file is it, based on the logs, please send me the file so I can take a look here.

Thanks!

That was the problem! I set loglevel to 'trace', so that i found the file containing the wrong tags. Then I followed jamisonhyatt's tip and converted with mp3v2. Now it works like a charm. I try to give you the original file.

Thanks for your help!!

PS: i don't know what caused the wrong tags. It was a song, which was unchanged for years in my library.

@GitSchorsch , do you still have a backup of the file? It would help to have it to try debug the issue in the library.

@GitSchorsch , do you still have a backup of the file? It would help to have it to try debug the issue in the library.

here it is :-) I was able to reproduce the error with the original file. Right after adding it, the error was shown and navidrome crashed.

03 - Semblance Of Confusion - defect.zip

Sorry, i've closed the issue by accident...

I get this too, see below. Rewriting the id3 tags fixes it, do you need me to send the file it chokes on?

The tag seems to have a weird comment frame containing the : character, which might be the reason that TagLib chokes on it:

Screenshot 2020-10-30 at 14 19 21

INFO[0073] Finished processing changed folder            dir="/Volumes/MusicDrive/Music/2017/Diamanda Galas - 2003 - Defixiones, Will and Testament" elapsed=420.92037ms purged=0 updated=17
panic: runtime error: slice bounds out of range [:3] with capacity 1

goroutine 38 [running]:
github.com/dhowden/tag.readTextWithDescrFrame(0xc000342340, 0x2, 0x2, 0x101, 0x5acbe20, 0x0, 0x0)
    /go/pkg/mod/github.com/wader/[email protected]/id3v2frames.go:460 +0x475
github.com/dhowden/tag.readID3v2Frames(0x4b1cde0, 0xc00027b798, 0x65, 0xc00040a000, 0xc00027b798, 0x0, 0x0)
    /go/pkg/mod/github.com/wader/[email protected]/id3v2.go:364 +0x925
github.com/dhowden/tag.ReadID3v2Tags(0x4b265e0, 0xc00027b798, 0x1, 0x0, 0x0, 0x0)
    /go/pkg/mod/github.com/wader/[email protected]/id3v2.go:428 +0xe5
github.com/dhowden/tag.ReadFrom(0x4b265e0, 0xc00027b798, 0x0, 0x0, 0xc00027b798, 0x0)
    /go/pkg/mod/github.com/wader/[email protected]/tag.go:52 +0x333
github.com/deluan/navidrome/scanner/metadata.hasEmbeddedImage(0xc0000b2880, 0x79, 0xc000192d00)
    /github/workspace/scanner/metadata/taglib.go:69 +0x19c
github.com/deluan/navidrome/scanner/metadata.(*taglibExtractor).extractMetadata(0x5acae70, 0xc0000b2880, 0x79, 0xc0007531f8, 0x44e2dcd, 0x4733f10)
    /github/workspace/scanner/metadata/taglib.go:57 +0x353
github.com/deluan/navidrome/scanner/metadata.(*taglibExtractor).Extract(0x5acae70, 0xc000078200, 0xf, 0x10, 0xc00022baa0, 0x8, 0x1)
    /github/workspace/scanner/metadata/taglib.go:35 +0x85
github.com/deluan/navidrome/scanner/metadata.Extract(0xc000078200, 0xf, 0x10, 0x60, 0x58, 0x49d6720)
    /github/workspace/scanner/metadata/metadata.go:34 +0x9a
github.com/deluan/navidrome/scanner.(*TagScanner).loadTracks(0xc0004d4cc0, 0xc000078200, 0xf, 0x10, 0xc000252020, 0x1, 0x1, 0xc000040900, 0xc0007538b8)
    /github/workspace/scanner/tag_scanner.go:343 +0x5d
github.com/deluan/navidrome/scanner.(*TagScanner).addOrUpdateTracksInDB(0xc0004d4cc0, 0x4b2e720, 0xc00040d560, 0xc00016c000, 0x4d, 0xc000754288, 0xc000078200, 0xf, 0x10, 0xc0007542b8, ...)
    /github/workspace/scanner/tag_scanner.go:318 +0x537
github.com/deluan/navidrome/scanner.(*TagScanner).processChangedDir(0xc0004d4cc0, 0x4b2e720, 0xc00040d560, 0xc00016c000, 0x4d, 0x0, 0x0)
    /github/workspace/scanner/tag_scanner.go:275 +0xf1c
github.com/deluan/navidrome/scanner.(*TagScanner).Scan(0xc0004d4cc0, 0x4b2e720, 0xc00040cea0, 0x0, 0x0, 0x0, 0xc00040cea0, 0x6ca1910)
    /github/workspace/scanner/tag_scanner.go:101 +0x4e5
github.com/deluan/navidrome/scanner.(*Scanner).Rescan(0xc00019dcc0, 0xc0001a2380, 0x1e, 0xc0004b5600, 0xb2770da, 0xc00052e000)
    /github/workspace/scanner/scanner.go:37 +0x1f8
github.com/deluan/navidrome/scanner.(*Scanner).RescanAll(0xc00019dcc0, 0x0, 0x0, 0x0)
    /github/workspace/scanner/scanner.go:49 +0xcf
github.com/deluan/navidrome/server.(*Server).initScanner.func1(0xc00019dd80, 0x34630b8a000)
    /github/workspace/server/server.go:86 +0x5e
created by github.com/deluan/navidrome/server.(*Server).initScanner
    /github/workspace/server/server.go:83 +0x188

This happens when I use the dhowden/tag to detect embedded images. While we wait for an answer from the upstream library, I changed the code to detect such errors and recover from the panic, assuming the track does not have an embedded cover and showing only the line bellow in the logs:

ERRO[0072] Panic while checking for images. Please report this error with a copy of the file  error="runtime error: slice bounds out of range [:3] with capacity 1" path="/Users/deluan/Music/Music/Media/_/03 - Semblance Of Confusion - defect.mp3"
Was this page helpful?
0 / 5 - 0 ratings

Related issues

vs49688 picture vs49688  Â·  5Comments

BobWs picture BobWs  Â·  3Comments

brianpierson2020 picture brianpierson2020  Â·  7Comments

BobWs picture BobWs  Â·  3Comments

TheForcer picture TheForcer  Â·  5Comments