gastownhall/beads · error
failed to fetch issue: %w
Error message
failed to fetch issue: %w
What it means
After passing the eligibility check, CompactTier1 fetches the full issue via store.GetIssue. If that fetch fails, the compaction aborts with this wrapped error. This is a storage-layer read failure on a record the eligibility check just saw, so it often indicates a race or backend problem.
Source
Thrown at internal/compact/compactor.go:107
if ctx.Err() != nil {
return ctx.Err()
}
// Check eligibility before fetching issue (fail fast)
eligible, reason, err := c.store.CheckEligibility(ctx, issueID, 1)
if err != nil {
return fmt.Errorf("failed to verify eligibility: %w", err)
}
if !eligible {
if reason != "" {
return fmt.Errorf("issue %s is not eligible for Tier 1 compaction: %s", issueID, reason)
}
return fmt.Errorf("issue %s is not eligible for Tier 1 compaction", issueID)
}
issue, err := c.store.GetIssue(ctx, issueID)
if err != nil {
return fmt.Errorf("failed to fetch issue: %w", err)
}
// Calculate original size
originalSize := len(issue.Description) + len(issue.Design) + len(issue.Notes) + len(issue.AcceptanceCriteria)
if c.config.DryRun {
return fmt.Errorf("dry-run: would compact %s (original size: %d bytes)", issueID, originalSize)
}
// Get summary from AI
summary, err := c.summarizer.SummarizeTier1(ctx, issue)
if err != nil {
return fmt.Errorf("failed to summarize: %w", err)
}
// Check if compaction would actually reduce size
compactedSize := len(summary)
if compactedSize >= originalSize {View on GitHub (pinned to 71377f2769)
Solutions
- Check whether the issue still exists (bd show <issueID>)
- Inspect the wrapped error for the storage root cause
- Retry once the database/connection is healthy
- Re-run eligibility + compaction after any concurrent writers have finished
Defensive patterns
Strategy: retry
Validate before calling
if _, err := store.GetIssue(ctx, issueID); err != nil {
return fmt.Errorf("issue %s unreadable before compaction: %w", issueID, err)
} Try / catch
err := c.CompactTier1(ctx, id)
if err != nil && strings.Contains(err.Error(), "failed to fetch issue") {
time.Sleep(backoff)
err = c.CompactTier1(ctx, id)
}
return err Prevention
- Avoid deleting issues while a compaction batch is running
- Use a context with adequate timeout for the store read
- Retry fetch failures — they are often transient connection drops
When it happens
Trigger: store.GetIssue(ctx, issueID) returns a non-nil error — e.g. the issue was deleted between CheckEligibility and GetIssue, the database connection dropped, or the storage backend returned an internal error.
Common situations: Concurrent deletion of the issue while a compaction runs; database outage mid-operation; corrupted database; transient network failure against a remote Dolt server.
Understand the failure class
Background: Record Not Found Errors: "not found", RecordNotFound, and "was not found" — what they mean and how to fix them — this error's family across 28 libraries.
Related errors
- get molecule children: %w
- failed to get issue %s: %w
- failed to remove relates-to %s -> %s: %w
- failed to get epic: %v
- failed to get issue: %v
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/8bd3fdb9758e7093.
Report an issue: GitHub.