gastownhall/beads · error
get labels: id must not be empty
Error message
get labels: id must not be empty
What it means
Returned by list (GetLabels / GetWispLabels) when the ID is empty. The use case rejects empty IDs before querying the repository. Note the error for a valid-but-failing read uses a slightly different format ('get labels %s'), so this exact message always means the ID string itself was empty.
Source
Thrown at internal/storage/domain/label.go:193
if err := u.labelRepo.Insert(ctx, id, l, actor, opts); err != nil {
return fmt.Errorf("set labels: add %s: %w", l, err)
}
}
}
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 {View on GitHub (pinned to 71377f2769)
Solutions
- Verify the ID was captured from CreateIssue/lookup before calling GetLabels
- Guard with a non-empty check and skip or error per record
- Fix the upstream producer of the empty ID
- Use GetWispLabels for wisps, passing the wisp ID
Example fix
// before
labels, _ := store.GetLabels(ctx, record.ID) // record.ID empty
// after
if record.ID == "" { continue }
labels, err := store.GetLabels(ctx, record.ID) Defensive patterns
Strategy: validation
Validate before calling
if id == "" {
return nil, fmt.Errorf("cannot get labels: id is empty")
}
labels, err := store.GetLabels(ctx, id) Prevention
- Check ID non-empty before label reads, especially in template/dashboard loops
- Skip or log records lacking IDs in bulk reporting
- Capture IDs at creation time and propagate them explicitly
- Use GetWispLabels for wisps
When it happens
Trigger: GetLabels(ctx, "") or GetWispLabels(ctx, ""); reading IDs from JSON/YAML where the field was omitted; calling before an issue was created and its ID captured.
Common situations: Template generators rendering label views for unset IDs; dashboards iterating over records where some entries lack IDs; wiring mistakes passing the wrong struct field.
Related errors
- add labels: id must not be empty
- remove labels: id must not be empty
- set labels: id must not be empty
- db: Exists: id must not be empty
- db: LabelSQLRepository.Insert: issueID must not be empty
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/e92ef84bfb01514b.
Report an issue: GitHub.