gastownhall/beads · error
History: %w
Error message
History: %w
What it means
Pass-through wrapper from History in the issue use-case: wraps errors from issueRepo.History(ctx, id), which fetches the event/audit history entries for an issue. A failure reading history from storage surfaces as 'History: <root cause>'.
Source
Thrown at internal/storage/domain/issue.go:1849
out, err := u.issueRepo.CountIssues(ctx, query, filter)
if err != nil {
return 0, fmt.Errorf("CountIssues: %w", err)
}
return out, nil
}
func (u *issueUseCaseImpl) CountIssuesByGroup(ctx context.Context, filter types.IssueFilter, groupBy string) (map[string]int, error) {
out, err := u.issueRepo.CountIssuesByGroup(ctx, filter, groupBy)
if err != nil {
return nil, fmt.Errorf("CountIssuesByGroup: %w", err)
}
return out, nil
}
func (u *issueUseCaseImpl) History(ctx context.Context, id string) ([]*storage.HistoryEntry, error) {
out, err := u.issueRepo.History(ctx, id)
if err != nil {
return nil, fmt.Errorf("History: %w", err)
}
return out, nil
}
func (u *issueUseCaseImpl) IterEvents(ctx context.Context, id string, limit int) (storage.Iter[types.Event], error) {
out, err := u.issueRepo.IterEvents(ctx, id, limit)
if err != nil {
return nil, fmt.Errorf("IterEvents: %w", err)
}
return out, nil
}
func (u *issueUseCaseImpl) GetStaleIssues(ctx context.Context, filter types.StaleFilter) ([]*types.Issue, error) {
out, err := u.issueRepo.GetStaleIssues(ctx, filter)
if err != nil {
return nil, fmt.Errorf("GetStaleIssues: %w", err)
}
return out, nilView on GitHub (pinned to 71377f2769)
Solutions
- Inspect the wrapped error after 'History:' for the root cause
- Verify the issue ID exists before fetching history
- Check the events table exists and the schema is migrated
- Retry on transient storage errors
Defensive patterns
Strategy: try-catch
Validate before calling
if id == "" {
return nil, fmt.Errorf("history: empty issue id")
} Type guard
func hasID(id string) bool { return strings.TrimSpace(id) != "" } Try / catch
entries, err := uc.History(ctx, id)
if err != nil {
log.Warnf("history unavailable for %s: %v", id, err)
return nil
} Prevention
- Verify the issue exists before fetching history
- Keep the events/history schema migrated and avoid manual pruning
- Retry transient storage errors
- Validate IDs at CLI/agent boundaries before storage calls
When it happens
Trigger: Calling History(ctx, id) when the repository's history/event query errors — the issue ID does not exist, the events table is missing/corrupt, or the database is unreachable.
Common situations: Requesting history for a typo'd or deleted issue ID; running against a database where the events/history table was pruned or not migrated; connection drop during iteration with a large limit.
Related errors
- not found
- load wisp labels: %w
- edge %d %s->%s: checking planned blocking cycle: %w
- reading existing dependencies for %s: %w
- CountOpenChildren %s: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/1d164b15808fb7b8.
Report an issue: GitHub.