gastownhall/beads · error
GetStaleIssues: %w
Error message
GetStaleIssues: %w
What it means
Wrapped error from GetStaleIssues in the issue use-case layer. The repo call issueRepo.GetStaleIssues is invoked with a StaleFilter; any repository failure is returned with a "GetStaleIssues: " prefix. This error always indicates a failure beneath the use-case layer, not a validation failure.
Source
Thrown at internal/storage/domain/issue.go:1865
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, nil
}
func (u *issueUseCaseImpl) GetEpicsEligibleForClosure(ctx context.Context) ([]*types.EpicStatus, error) {
out, err := u.issueRepo.GetEpicsEligibleForClosure(ctx)
if err != nil {
return nil, fmt.Errorf("GetEpicsEligibleForClosure: %w", err)
}
return out, nil
}
func (u *issueUseCaseImpl) Unclaim(ctx context.Context, id, actor string, force bool) error {
if id == "" {
return fmt.Errorf("Unclaim: id must not be empty")
}
if err := u.issueRepo.UnclaimIssue(ctx, id, actor, force); err != nil {
return fmt.Errorf("Unclaim: %w", err)View on GitHub (pinned to 71377f2769)
Solutions
- Unwrap the error to identify the repository-level cause
- Validate the StaleFilter fields (statuses, age thresholds) before calling
- Check database connectivity and schema state
- Retry if the wrapped error is transient
Defensive patterns
Strategy: validation
Validate before calling
if filter.Limit < 0 || len(filter.Statuses) == 0 {
return fmt.Errorf("invalid StaleFilter: limit=%d statuses=%v", filter.Limit, filter.Statuses)
} Try / catch
issues, err := uc.GetStaleIssues(ctx, filter)
if err != nil {
return fmt.Errorf("stale scan failed: %w", err)
} Prevention
- Validate StaleFilter fields against the allowed values before calling
- Health-check DB connectivity before scheduled stale scans
- Log the wrapped cause, not just the prefix
When it happens
Trigger: Calling GetStaleIssues(ctx, filter) when the repository query fails: bad connection, SQL/Dolt error, or an invalid StaleFilter value that the query layer rejects.
Common situations: Running bd's stale-issue scans when the database is unreachable or mid-migration; constructing a StaleFilter with unsupported values that break the query.
Related errors
- not found
- load wisp labels: %w
- edge %d %s->%s: checking planned blocking cycle: %w
- reading existing dependencies for %s: %w
- searching children of %s: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/76309876cb4c52da.
Report an issue: GitHub.