gastownhall/beads · error
get labels %s: %w
Error message
get labels %s: %w
What it means
Wraps a failure from labelRepo.List in list (GetLabels / GetWispLabels). The message includes the ID being queried plus the underlying storage error. The read failed so no labels are returned; this never means the ID was empty (that is the sibling 'id must not be empty' error).
Source
Thrown at internal/storage/domain/label.go:197
}
return nil
}
func (u *labelUseCaseImpl) GetLabels(ctx context.Context, issueID string) ([]string, error) {
return u.list(ctx, issueID, false)
}
func (u *labelUseCaseImpl) GetWispLabels(ctx context.Context, wispID string) ([]string, error) {
return u.list(ctx, wispID, true)
}
func (u *labelUseCaseImpl) list(ctx context.Context, id string, useWisp bool) ([]string, error) {
if id == "" {
return nil, fmt.Errorf("get labels: id must not be empty")
}
out, err := u.labelRepo.List(ctx, id, LabelOpts{UseWispsTable: useWisp})
if err != nil {
return nil, fmt.Errorf("get labels %s: %w", id, err)
}
return out, nil
}
func (u *labelUseCaseImpl) GetLabelsForIssues(ctx context.Context, issueIDs []string) (map[string][]string, error) {
return u.listBulk(ctx, issueIDs, false)
}
func (u *labelUseCaseImpl) GetLabelsForWisps(ctx context.Context, wispIDs []string) (map[string][]string, error) {
return u.listBulk(ctx, wispIDs, true)
}
func (u *labelUseCaseImpl) listBulk(ctx context.Context, ids []string, useWisp bool) (map[string][]string, error) {
if len(ids) == 0 {
return map[string][]string{}, nil
}
out, err := u.labelRepo.ListByIssueIDs(ctx, ids, LabelOpts{UseWispsTable: useWisp})
if err != nil {View on GitHub (pinned to 71377f2769)
Solutions
- Inspect the wrapped error for the storage root cause
- Verify connectivity and migration state of the database
- Sync the database if the record may not exist locally yet (bd dolt pull)
- Retry — a pure read is safe to retry after transient failures
Example fix
// before
labels, err := store.GetLabels(ctx, id)
if err != nil { log.Fatal(err) }
// after
labels, err := store.GetLabels(ctx, id)
if err != nil {
return fmt.Errorf("get labels for %s: %w", id, err) // id included in message already
} Defensive patterns
Strategy: retry
Validate before calling
// Ensure ID non-empty first; then the error only means storage/read failure.
if id == "" { return nil, fmt.Errorf("empty id") } Try / catch
labels, err := store.GetLabels(ctx, id)
if err != nil {
time.Sleep(200 * time.Millisecond)
labels, err = store.GetLabels(ctx, id) // read is safe to retry
if err != nil { return nil, fmt.Errorf("get labels %s: %w", id, err) }
} Prevention
- Retry transient read failures with backoff
- Keep the local Dolt database in sync (bd dolt pull) before reading
- Run migrations so labels tables exist
- Include the ID in your own error context for diagnosis
When it happens
Trigger: GetLabels/GetWispLabels on a non-empty ID where labelRepo.List fails: database unavailable, driver error, table missing due to skipped migration, transaction conflict.
Common situations: Dolt remote not pulled / stale database; running commands before migrations created labels tables; transient connectivity loss; querying an ID in the wrong database.
Related errors
- db: GetConfig %s: %w
- delete: drop labels: %w
- delete: drop wisp labels: %w
- add label %s/%s: %w
- remove label %s/%s: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/8757865aea2f0a75.
Report an issue: GitHub.