gastownhall/beads · error
delete: drop wisp events: %w
Error message
delete: drop wisp events: %w
What it means
Same event cascade step as 'drop events' but for wisps: eventsRepo.DeleteAllForIDs with UseWispsTable:true deletes wisp event rows. A wrapped error here means wisp event cleanup failed and the entire deleteMany aborts to keep events consistent with deleted wisps.
Source
Thrown at internal/storage/domain/issue_delete.go:193
// survive their target unless they are deleted explicitly. Without this a
// forced delete of a wisp left its durable dependent holding an edge into
// a row that no longer exists — dangling, not orphaned, which is not what
// issueops.DeleteRequest.Force promises. The store body has always done
// this (issueops.deleteIssueRowInTx -> DeleteWispFromDependenciesInTx).
if _, err := u.depRepo.DeleteAllForIDs(ctx, wispIDs, DepInsertOpts{}); err != nil {
return result, fmt.Errorf("delete: drop sync-plane edges into deleted wisps: %w", err)
}
if _, err := u.labelRepo.DeleteAllForIDs(ctx, regularIDs, LabelOpts{}); err != nil {
return result, fmt.Errorf("delete: drop labels: %w", err)
}
if _, err := u.labelRepo.DeleteAllForIDs(ctx, wispIDs, LabelOpts{UseWispsTable: true}); err != nil {
return result, fmt.Errorf("delete: drop wisp labels: %w", err)
}
if _, err := u.eventsRepo.DeleteAllForIDs(ctx, regularIDs, RecordEventOpts{}); err != nil {
return result, fmt.Errorf("delete: drop events: %w", err)
}
if _, err := u.eventsRepo.DeleteAllForIDs(ctx, wispIDs, RecordEventOpts{UseWispsTable: true}); err != nil {
return result, fmt.Errorf("delete: drop wisp events: %w", err)
}
issuesDeleted, err := u.issueRepo.DeleteByIDs(ctx, regularIDs, IssueTableOpts{})
if err != nil {
return result, fmt.Errorf("delete: drop issue rows: %w", err)
}
wispsDeleted, err := u.issueRepo.DeleteByIDs(ctx, wispIDs, IssueTableOpts{UseWispsTable: true})
if err != nil {
return result, fmt.Errorf("delete: drop wisp rows: %w", err)
}
result.DeletedCount = issuesDeleted + wispsDeleted
if params.UpdateTextReferences && len(connected) > 0 {
refs, err := u.rewriteTextReferences(ctx, allIDs, connected, connectedIsWisp, actor)
if err != nil {
return result, fmt.Errorf("delete: rewrite text references: %w", err)
}
result.ReferencesUpdated = refsView on GitHub (pinned to 71377f2769)
Solutions
- Verify the wisps events table exists; migrate the embedded schema.
- Retry the delete — no partial event rows remain.
- Inspect the wrapped driver error for the root cause.
- Delete wisps in smaller batches to reduce lock pressure.
Defensive patterns
Strategy: validation
Validate before calling
if err := ctx.Err(); err != nil { return err }
exists, err := tableExists(ctx, "wisps_events"); if err != nil || !exists { return fmt.Errorf("wisp events table missing — run migrations") } Type guard
var dbe *storage.DBError
if errors.As(err, &dbe) { /* inspect driver cause */ } Try / catch
if err := store.DeleteWisps(ctx, ids, opts); err != nil {
if strings.Contains(err.Error(), "delete: drop wisp events:") { /* retry after health check */ }
} Prevention
- Migrate old embedded databases to current schema.
- Use single-writer access to avoid lock contention.
- Batch wisp deletions.
- Monitor embedded store disk usage.
When it happens
Trigger: Deleting wisps when the wisps events table is missing/locked, the driver returns an SQL error, or the context/connection drops mid-cascade.
Common situations: Older embedded schema lacking the wisps events table; heavy event volume on wisps causing lock timeouts; concurrent bd process contention.
Related errors
- applyGraph: read existing wisp deps for %s: %w
- delete: drop wisp deps: %w
- delete: drop sync-plane edges into deleted wisps: %w
- delete: drop wisp labels: %w
- delete: drop events: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/d2cf55490254723e.
Report an issue: GitHub.