l3montree-dev / l3montree-dev/devguard
Asset pipeline can't record its own error: foreign key violation on deleted/missing project
Open
Nobody has claimed this yet.
bug
component/devguard-api
priority:high
- Dominant language
- Go
- Stars
- 161
- Forks
- 43
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 37
Description
Error
*errors.withStack: could not save pipeline error to asset: ERROR: insert or update on table "assets" violates foreign key constraint "fk_projects_assets" (SQLSTATE 23503)
Stack trace
Alert (monitoring/alert.go:29)
← (*DaemonRunner).collectErrors.func1 (daemons/daemon_asset_pipeline.go:136)
Underlying cause chain: *pgconn.PgError (SQLSTATE 23503) → could not save pipeline error to asset: ... (same message, wrapped)
Request context
- The asset pipeline daemon (
collectErrors) tried to write a pipeline error onto anassetsrow, but the update was rejected because it violatesfk_projects_assets— i.e. the asset's referencedproject_iddoesn't exist in theprojectstable (likely the parent project was deleted concurrently, or the asset row references a stale/nonexistent project). - This is doubly bad: not only did the underlying pipeline step fail, but the failure-recording path itself throws, so the original error content is lost and only this secondary FK violation is surfacing in GlitchTip.
- Worth checking whether asset/project deletion should cascade-delete or block deletion while a pipeline run references the asset, and whether
collectErrorsshould tolerate a missing project gracefully instead of crashing.
GlitchTip
- Issue: https://error-tracking.devguard.org/devguard/issues/3615
- Event ID: 019fc51a3595754e8c54d78fd5170fbd
- First seen: 2026-08-03T00:50:50.069Z
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in monitoring/alert.go:29 and daemons/daemon_asset_pipeline.go:136, then inspect DaemonRunner.collectErrors and the fk_projects_assets relationship. Reproduce or trace the missing-project path and determine how deletion and error recording currently interact. Done means the original pipeline error remains available without the recording path failing on a missing project.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- go, postgresql
- Domain
- backend, databases
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 48/100