Logs: Vision caption thumbnail returns wrong error variable #2464

Open
opened 2026-02-20 01:11:56 -05:00 by deekerman · 2 comments
Owner

Originally created by @dyptan-io on GitHub (Dec 27, 2025).

Originally assigned to: @graciousgrey, @dyptan-io on GitHub.

Before You Continue

  • This is a new, confirmed bug that has not yet been reported or documented

What Is Not Working as Documented?

When vision generates caption thumbnails for specific media (corrupted media in my example), it crashes due to the wrong error variable being returned.

How Can We Reproduce It?

Run against media that cannot generate a thumbnail, like corrupted files?

What Behavior Do You Expect?

The program logs the error and continues with the remaining media instead of crashing with panic.

What Could Be the Cause?

Likelly a bug in the following code:

// Get thumbnail filenames for the selected sizes.
fileName, fileErr := m.Thumbnail(Config().ThumbCachePath(), size.Name)

if fileErr != nil {
	return caption, err // <-- Must be a fileErr.
}

Logs, Sample Files, or Screenshots

@251223-questing-slim:\w$ PHOTOPRISM_LOG_LEVEL=debug photoprism vision run
INFO[2025-12-27T17:40:02Z] Become a member today, support our mission and enjoy our member benefits! 💎 
INFO[2025-12-27T17:40:02Z] Visit https://www.photoprism.app/membership to learn more. 
DEBU[2025-12-27T17:40:02Z] config: successfully initialized [54.943854ms] 
INFO[2025-12-27T17:40:02Z] vision: running caption models               
DEBU[2025-12-27T17:40:07Z] photos: found 37,286 results for caption:false primary:true dist:2.000000 count:100000 order:added [5.470811556s] 
INFO[2025-12-27T17:40:07Z] vision: processing 37,286 pictures           
DEBU[2025-12-27T17:40:07Z] metadata: 7894704f98c2a362280ce91d0b947cfcc41c716e_exiftool.json not found (no such file or directory) 
DEBU[2025-12-27T17:40:07Z] exif not supported in 2009-07-30-204.jpg     
DEBU[2025-12-27T17:40:07Z] vips: unsupported image format in 2009-07-30-204.jpg (load image from file) 
DEBU[2025-12-27T17:40:07Z] media: failed to create thumbnail for 2009-07-30-204.jpg (unsupported image format) 
ERRO[2025-12-27T17:40:07Z] vision: runtime error: invalid memory address or nil pointer dereference (worker panic)
stack: goroutine 1 [running]:
runtime/debug.Stack()
        /usr/local/go/src/runtime/debug/stack.go:26 +0x64
github.com/photoprism/photoprism/internal/workers.(*Vision).Start.func1()
        /go/src/github.com/photoprism/photoprism/internal/workers/vision.go:94 +0x3c
panic({0x16e8400?, 0x36c32c0?})
        /usr/local/go/src/runtime/panic.go:783 +0x120
github.com/photoprism/photoprism/internal/workers.(*Vision).Start(0x4006707620, {0x0, 0x0}, 0x186a0, {0x40002dfa30, 0x1, 0x1}, {0x0, 0x0}, 0x0, ...)
        /go/src/github.com/photoprism/photoprism/internal/workers/vision.go:259 +0x1700
github.com/photoprism/photoprism/internal/commands.visionRunAction.func1(0x2a37a70?)
        /go/src/github.com/photoprism/photoprism/internal/commands/vision_run.go:60 +0x37c
github.com/photoprism/photoprism/internal/commands.CallWithDependencies(0x18?, 0x40026cb6a8)
        /go/src/github.com/photoprism/photoprism/internal/commands/commands.go:142 +0xbc
github.com/photoprism/photoprism/internal/commands.visionRunAction(0x40027f8d80?)
        /go/src/github.com/photoprism/photoprism/internal/commands/vision_run.go:40 +0x2c
github.com/urfave/cli/v2.(*Command).Run(0x370b0c0, 0x40027f8d80, {0x400287efd0, 0x1, 0x1})
        /go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/command.go:276 +0x580
github.com/urfave/cli/v2.(*Command).Run(0x370b220, 0x40027f8c80, {0x400287b5c0, 0x2, 0x2})
        /go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/command.go:269 +0x774
github.com/urfave/cli/v2.(*Command).Run(0x4001103ce0, 0x4000f1c580, {0x400003e3f0, 0x3, 0x3})
        /go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/command.go:269 +0x774
github.com/urfave/cli/v2.(*App).RunContext(0x4002730000, {0x2a37a70, 0x46613c0}, {0x400003e3f0, 0x3, 0x3})
        /go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/app.go:333 +0x4c8
github.com/urfave/cli/v2.(*App).Run(...)
        /go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/app.go:307
main.main()
        /go/src/github.com/photoprism/photoprism/plus/cmd/photoprism-plus/photoprism-plus.go:52 +0x284 
DEBU[2025-12-27T17:40:07Z] closed database connection                   

Which Software Versions Do You Use?

- Photoprism latest Vision CLI

On What Device Is PhotoPrism Installed?

Docker for arm64

Do You Use a Reverse Proxy, Firewall, VPN, or CDN?

No response

Originally created by @dyptan-io on GitHub (Dec 27, 2025). Originally assigned to: @graciousgrey, @dyptan-io on GitHub. ### Before You Continue - [x] This is a new, confirmed bug that has not yet been reported or documented ### What Is Not Working as Documented? When vision generates caption thumbnails for specific media (corrupted media in my example), it crashes due to the wrong error [variable](https://github.com/photoprism/photoprism/blob/8296708037a1726f609113e6be6171895028058b/internal/photoprism/mediafile_vision.go#L38-L42) being returned. ### How Can We Reproduce It? Run against media that cannot generate a thumbnail, like corrupted files? ### What Behavior Do You Expect? The program logs the error and continues with the remaining media instead of crashing with panic. ### What Could Be the Cause? Likelly a bug in the following [code](https://github.com/photoprism/photoprism/blob/8296708037a1726f609113e6be6171895028058b/internal/photoprism/mediafile_vision.go#L38-L42): ```go // Get thumbnail filenames for the selected sizes. fileName, fileErr := m.Thumbnail(Config().ThumbCachePath(), size.Name) if fileErr != nil { return caption, err // <-- Must be a fileErr. } ``` ### Logs, Sample Files, or Screenshots ```sh @251223-questing-slim:\w$ PHOTOPRISM_LOG_LEVEL=debug photoprism vision run INFO[2025-12-27T17:40:02Z] Become a member today, support our mission and enjoy our member benefits! 💎 INFO[2025-12-27T17:40:02Z] Visit https://www.photoprism.app/membership to learn more. DEBU[2025-12-27T17:40:02Z] config: successfully initialized [54.943854ms] INFO[2025-12-27T17:40:02Z] vision: running caption models DEBU[2025-12-27T17:40:07Z] photos: found 37,286 results for caption:false primary:true dist:2.000000 count:100000 order:added [5.470811556s] INFO[2025-12-27T17:40:07Z] vision: processing 37,286 pictures DEBU[2025-12-27T17:40:07Z] metadata: 7894704f98c2a362280ce91d0b947cfcc41c716e_exiftool.json not found (no such file or directory) DEBU[2025-12-27T17:40:07Z] exif not supported in 2009-07-30-204.jpg DEBU[2025-12-27T17:40:07Z] vips: unsupported image format in 2009-07-30-204.jpg (load image from file) DEBU[2025-12-27T17:40:07Z] media: failed to create thumbnail for 2009-07-30-204.jpg (unsupported image format) ERRO[2025-12-27T17:40:07Z] vision: runtime error: invalid memory address or nil pointer dereference (worker panic) stack: goroutine 1 [running]: runtime/debug.Stack() /usr/local/go/src/runtime/debug/stack.go:26 +0x64 github.com/photoprism/photoprism/internal/workers.(*Vision).Start.func1() /go/src/github.com/photoprism/photoprism/internal/workers/vision.go:94 +0x3c panic({0x16e8400?, 0x36c32c0?}) /usr/local/go/src/runtime/panic.go:783 +0x120 github.com/photoprism/photoprism/internal/workers.(*Vision).Start(0x4006707620, {0x0, 0x0}, 0x186a0, {0x40002dfa30, 0x1, 0x1}, {0x0, 0x0}, 0x0, ...) /go/src/github.com/photoprism/photoprism/internal/workers/vision.go:259 +0x1700 github.com/photoprism/photoprism/internal/commands.visionRunAction.func1(0x2a37a70?) /go/src/github.com/photoprism/photoprism/internal/commands/vision_run.go:60 +0x37c github.com/photoprism/photoprism/internal/commands.CallWithDependencies(0x18?, 0x40026cb6a8) /go/src/github.com/photoprism/photoprism/internal/commands/commands.go:142 +0xbc github.com/photoprism/photoprism/internal/commands.visionRunAction(0x40027f8d80?) /go/src/github.com/photoprism/photoprism/internal/commands/vision_run.go:40 +0x2c github.com/urfave/cli/v2.(*Command).Run(0x370b0c0, 0x40027f8d80, {0x400287efd0, 0x1, 0x1}) /go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/command.go:276 +0x580 github.com/urfave/cli/v2.(*Command).Run(0x370b220, 0x40027f8c80, {0x400287b5c0, 0x2, 0x2}) /go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/command.go:269 +0x774 github.com/urfave/cli/v2.(*Command).Run(0x4001103ce0, 0x4000f1c580, {0x400003e3f0, 0x3, 0x3}) /go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/command.go:269 +0x774 github.com/urfave/cli/v2.(*App).RunContext(0x4002730000, {0x2a37a70, 0x46613c0}, {0x400003e3f0, 0x3, 0x3}) /go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/app.go:333 +0x4c8 github.com/urfave/cli/v2.(*App).Run(...) /go/pkg/mod/github.com/urfave/cli/v2@v2.27.7/app.go:307 main.main() /go/src/github.com/photoprism/photoprism/plus/cmd/photoprism-plus/photoprism-plus.go:52 +0x284 DEBU[2025-12-27T17:40:07Z] closed database connection ``` ### Which Software Versions Do You Use? ```markdown - Photoprism latest Vision CLI ``` ### On What Device Is PhotoPrism Installed? ```markdown Docker for arm64 ``` ### Do You Use a Reverse Proxy, Firewall, VPN, or CDN? _No response_
Author
Owner

@lastzero commented on GitHub (Dec 29, 2025):

@dyptan-io Thanks for reporting this glitch! After reviewing the code, I discovered two more instances where the wrong error variable was used. You'll soon be able to test the fixes using our development preview build:

@lastzero commented on GitHub (Dec 29, 2025): @dyptan-io Thanks for reporting this glitch! After reviewing the code, I discovered two more instances where the wrong error variable was used. You'll soon be able to test the fixes using our development preview build: - https://docs.photoprism.app/release-notes/#development-preview - https://docs.photoprism.app/getting-started/updates/#development-preview
Author
Owner

@lastzero commented on GitHub (Feb 11, 2026):

We have updated our preview build to include fixes for this issue and several others:

It would be great if you could test it and provide feedback! :)

@lastzero commented on GitHub (Feb 11, 2026): We have updated our preview build to include fixes for this issue and several others: - https://docs.photoprism.app/release-notes/#development-preview - https://docs.photoprism.app/getting-started/updates/#development-preview It would be great if you could test it and provide feedback! :)
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/photoprism#2464
No description provided.