gastownhall/beads · error
IterEvents: %w
Error message
IterEvents: %w
What it means
This is a wrapped error from IterEvents in the issue use-case layer. The use case delegates to issueRepo.IterEvents and, if the repository returns an error, wraps it with an "IterEvents: " prefix before returning. The prefix identifies the failing operation while preserving the underlying cause via %w.
Source
Thrown at internal/storage/domain/issue.go:1857
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, 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, nilView on GitHub (pinned to 71377f2769)
Solutions
- Inspect the wrapped underlying error with errors.Unwrap or errors.As/Is to find the real cause
- Verify the issue id passed to IterEvents exists (e.g. via a Show/Get call first)
- Check database connectivity and that the current transaction (if any) is still valid
- Retry the call if the underlying error is transient (connection issues)
Example fix
// before
out, err := uc.IterEvents(ctx, id, 100)
if err != nil {
return err // loses underlying context
}
// after
out, err := uc.IterEvents(ctx, id, 100)
if err != nil {
var nfe types.ErrNotFound
if errors.As(err, &nfe) {
return fmt.Errorf("issue %s not found: %w", id, err)
}
return err
} Defensive patterns
Strategy: try-catch
Validate before calling
if id == "" {
return fmt.Errorf("issue id required before IterEvents")
} Try / catch
out, err := uc.IterEvents(ctx, id, limit)
if err != nil {
var target error
if errors.As(err, &target) { /* inspect wrapped cause */ }
return fmt.Errorf("listing events for %s: %w", id, err)
} Prevention
- Always check that the issue exists before iterating its events
- Use errors.Is/As on the wrapped error rather than string matching the prefix
- Keep retry logic at the caller for transient storage errors
When it happens
Trigger: Calling IterEvents(ctx, id, limit) when the underlying issueRepo.IterEvents call fails, e.g. the issue id does not exist, the database/transaction is unavailable, or a query-level error occurs.
Common situations: Querying an event stream for a deleted or mistyped issue id; database connection failures or Dolt errors during iteration; passing a limit the storage layer rejects.
Related errors
- History: %w
- not found
- load wisp labels: %w
- edge %d %s->%s: checking planned blocking cycle: %w
- reading existing dependencies for %s: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/dabb5ae3e780d0bc.
Report an issue: GitHub.