gastownhall/beads · error
querying epics: %w
Error message
querying epics: %w
What it means
findStaleMolecules first queries all epics eligible for closure via GetEpicsEligibleForClosure. A failure there is wrapped as 'querying epics: %w', so bd mol stale cannot enumerate stale molecule candidates.
Source
Thrown at cmd/bd/mol_stale.go:136
ui.RenderID(mol.ID), mol.Title, progress)
fmt.Printf(" → Close with: bd close %s\n", mol.ID)
}
fmt.Println()
}
fmt.Printf("Total: %d stale", result.TotalCount)
if result.BlockingCount > 0 {
fmt.Printf(", %d blocking other work", result.BlockingCount)
}
fmt.Println()
}
// findStaleMolecules queries the database for stale molecules
func findStaleMolecules(ctx context.Context, s molReader, blockingOnly, unassignedOnly, showAll bool) (*StaleResult, error) {
// Get all epics eligible for closure (complete but unclosed)
epicStatuses, err := s.GetEpicsEligibleForClosure(ctx)
if err != nil {
return nil, fmt.Errorf("querying epics: %w", err)
}
// Get blocked issues to find what each stale molecule is blocking
blockedIssues, err := s.GetBlockedIssues(ctx, types.WorkFilter{})
if err != nil {
return nil, fmt.Errorf("querying blocked issues: %w", err)
}
// Build map of issue ID -> what issues it's blocking
blockingMap := buildBlockingMap(blockedIssues)
var staleMolecules []*StaleMolecule
blockingCount := 0
for _, es := range epicStatuses {
// Skip if not eligible for close (not all children closed)
if !es.EligibleForClose {
continueView on GitHub (pinned to 71377f2769)
Solutions
- Check the wrapped cause and fix the underlying storage/server error first
- Run bd doctor to validate database integrity and schema version
- If proxied, confirm the daemon is reachable and retry
- Retry bd stale once the query layer is healthy
Defensive patterns
Strategy: try-catch
Validate before calling
// Health-check storage before stale scan
if err := s.GetBlockedIssues(ctx, types.WorkFilter{Limit: 1}); err != nil {
return fmt.Errorf("storage unavailable: %w", err)
} Type guard
func storageOK(s molReader) bool { return s != nil } Try / catch
res, err := findStaleMolecules(ctx, s, blockingOnly, unassignedOnly, showAll)
if err != nil {
if strings.Contains(err.Error(), "querying epics") {
log.Printf("epic query failed: %v", errors.Unwrap(err))
}
return err
} Prevention
- Run bd doctor to catch corrupt epic/dependency rows early
- In proxied mode, verify daemon connectivity before batch scans
- Complete interrupted syncs before running staleness analysis
When it happens
Trigger: bd mol stale when the epic-closure query fails: database unavailable, epic eligibility query error, proxied server returning an error, or schema mismatch.
Common situations: Dolt server down in proxied mode; corrupt or partially-migrated database; interrupted sync leaving inconsistent epic/dependency rows.
Related errors
- ErrQuery
- no storage backend is open
- storage backend does not support backup operations
- failed to get current commit for state: %w
- load wisp labels: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/b2108f44a8413a60.
Report an issue: GitHub.