gastownhall/beads · error
journal dependency removals for source-repo delete: %w
Error message
journal dependency removals for source-repo delete: %w
What it means
Before removing issue rows, dependency edges are journaled via RecordDependencyRemovalsForIssuesInTx; failure is wrapped as "journal dependency removals for source-repo delete: %w". This preserves the edge data for sync before deletion.
Source
Thrown at internal/storage/issueops/bulk_ops.go:210
return 0, nil
}
affectedIssues, affectedWisps, aerr := AffectedByDeletionInTx(ctx, tx, issueIDs, nil)
if aerr != nil {
return 0, fmt.Errorf("affected by source-repo delete: %w", aerr)
}
// Deleted issues hold no leases: clear them while the id set is still
// joinable (before the issues rows go away).
if _, err := tx.ExecContext(ctx,
`DELETE FROM leases WHERE issue_id IN (SELECT id FROM issues WHERE source_repo = ?)`, sourceRepo); err != nil {
return 0, fmt.Errorf("delete leases: %w", err)
}
// Edges are journaled before the rows go, while their source snapshots can
// still be read.
if err := RecordDependencyRemovalsForIssuesInTx(ctx, tx, issueIDs); err != nil {
return 0, fmt.Errorf("journal dependency removals for source-repo delete: %w", err)
}
result, err := tx.ExecContext(ctx, `DELETE FROM issues WHERE source_repo = ?`, sourceRepo)
if err != nil {
return 0, fmt.Errorf("delete issues: %w", err)
}
rowsAffected, err := result.RowsAffected()
if err != nil {
return 0, fmt.Errorf("rows affected: %w", err)
}
// Journal each deleted issue in the same transaction. issueIDs is the exact
// set removed by the DELETE above (both were scoped to source_repo), so
// there are no phantom records here. The source-repo bulk delete plumbing
// carries no actor, so the rows record none.
for _, id := range issueIDs {
if err := RecordDeleteInTx(ctx, tx, id, ""); err != nil {View on GitHub (pinned to 71377f2769)
Solutions
- Inspect the inner error returned by RecordDependencyRemovalsForIssuesInTx
- Verify the journal/dependencies tables exist and are writable
- Free disk space / raise quota if inserts fail from a full disk
- Retry with a longer context for large edge sets
Defensive patterns
Strategy: validation
Validate before calling
// confirm the journal table is present and writable
_, err := db.Exec("SELECT 1 FROM deletions LIMIT 1") // or the relevant journal table Type guard
var noTableErr interface{ Error() string }
_ = errors.As(err, &noTableErr) // "no such table" indicates schema drift Try / catch
if err != nil && strings.Contains(err.Error(), "journal dependency removals") {
// journal write failed: verify disk space/schema, retry transaction
return fmt.Errorf("cannot journal before delete: %w", err)
} Prevention
- Keep disk quota headroom for journal writes
- Run migrations before bulk deletes so journal tables exist
- Never skip journaling; without it sync cannot reproduce the delete
When it happens
Trigger: RecordDependencyRemovalsForIssuesInTx errors while reading or inserting dependency-removal records: failing SELECT on dependencies, INSERT into the journal/compaction table fails, or context canceled mid-way.
Common situations: Journal table missing or full (disk quota); schema drift between journal writer and reader; timeout while journaling a repo with thousands of edges.
Related errors
- database not available: %w
- db: AddRemote %s: %w
- db: RemoveRemote %s: %w
- capture dependency edges for rename %s -> %s: %w
- journal: snapshot comment for %s: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/58588e127a7201d6.
Report an issue: GitHub.