fix: return 404 not 500 when stored file gone from disk - #3734
Merged
Conversation
It had no HTTPError() method, so it surfaced as a 500.
A file row whose blob is gone from storage (Sentry API-OSS-50) made LoadFileByID return the raw storage path error, which the error handler turned into a 500 and reported to Sentry. Return ErrFileDoesNotExist instead and update the callers that matched on the path error.
tink-bot
temporarily deployed
to
preview-trusted
September 4, 2026 20:52 — with
GitHub Actions
Inactive
kolaente
approved these changes
Sep 4, 2026
kolaente
enabled auto-merge (rebase)
September 4, 2026 20:58
Preview DeploymentPreview deployments for this PR are available at:
The preview environment will start automatically on first visit. Subsequent pushes to this PR will update the Run locally with Dockerdocker pull ghcr.io/go-vikunja/vikunja:pr-3734
docker run -p 3456:3456 ghcr.io/go-vikunja/vikunja:pr-3734Last updated for commit 8df34db |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
DB row point at file. Blob gone from disk.
LoadFileByIDhand back raw storage path error, error handler turn into 500, Sentry eat noise (API-OSS-50). Broken install, not server bug — nowErrFileDoesNotExistwith new error code 4034, so 404.Callers that matched on
*fs.PathError(files.Dump, user data export) switched tofiles.IsErrFileDoesNotExist.How to verify
files.basepath, e.g./var/lib/vikunja/files/<file id>). Do not request the avatar before deleting it, otherwise the cached copy is served.GET /api/v1/avatar/<username>.Before this PR: HTTP 500, plus a
*fs.PathErrorreported to Sentry.