l3montree-dev / l3montree-dev/devguard

Asset pipeline can't record its own error: foreign key violation on deleted/missing project

Open
#2,758 1 comment 0 reactions 0 assignees View on GitHub

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 an assets row, but the update was rejected because it violates fk_projects_assets — i.e. the asset's referenced project_id doesn't exist in the projects table (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 collectErrors should tolerate a missing project gracefully instead of crashing.

GlitchTip

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.