gastownhall/beads · error
failed to search protos: %w
Error message
failed to search protos: %w
What it means
resolveProtoIDOrTitle resolves user input to a proto-molecule ID, first by ID lookup, then by searching all issues carrying the template label via s.GetIssuesByLabel. If that label search fails at the storage layer, it throws 'failed to search protos: %w'. This means the proto catalog itself could not be enumerated — distinct from 'no match found' (error 1274).
Source
Thrown at cmd/bd/template.go:274
protoID, err := utils.ResolvePartialID(ctx, s, input)
if err == nil {
// Verify it's a proto (has template label)
issue, getErr := s.GetIssue(ctx, protoID)
if getErr == nil && issue != nil {
labels, _ := s.GetLabels(ctx, protoID)
for _, label := range labels {
if label == BeadsTemplateLabel {
return protoID, nil // Found a valid proto by ID
}
}
}
// ID resolved but not a proto - continue to title search
}
// Strategy 2: Search for protos by title
protos, err := s.GetIssuesByLabel(ctx, BeadsTemplateLabel)
if err != nil {
return "", fmt.Errorf("failed to search protos: %w", err)
}
var matches []*types.Issue
var exactMatch *types.Issue
for _, proto := range protos {
// Check for exact title match (case-insensitive)
if strings.EqualFold(proto.Title, input) {
exactMatch = proto
break
}
// Check for partial title match (case-insensitive)
if strings.Contains(strings.ToLower(proto.Title), strings.ToLower(input)) {
matches = append(matches, proto)
}
}
if exactMatch != nil {View on GitHub (pinned to 71377f2769)
Solutions
- Inspect the wrapped error (errors.Unwrap) for the underlying storage cause.
- Run `bd doctor` to validate database and label-index health.
- Retry once transient driver errors are excluded.
- If the label index is corrupt, re-export/re-sync the database to rebuild it.
Defensive patterns
Strategy: try-catch
Try / catch
pid, err := resolveProtoIDOrTitle(ctx, s, input)
if err != nil {
var storageErr bool
if strings.Contains(err.Error(), "failed to search protos") { storageErr = true }
// distinguish storage failure from not-found/ambiguous and report accordingly
return err
} Prevention
- Keep the label index healthy; re-sync after failed database operations.
- Run `bd doctor` when label-based searches begin failing.
- Ensure the process has read access to the .beads database.
When it happens
Trigger: Calling any command that resolves a proto by ID-or-title when GetIssuesByLabel(BeadsTemplateLabel) errors: label index corruption, storage/driver failure, or transaction issues during the query.
Common situations: Dolt database in a bad state after an interrupted sync; embedded driver I/O error; permission problems reading the .beads database file.
Related errors
- failed to search issues: %w
- add label '%s' on %s: %w
- add label '%s' on %s: %w
- searching local issues for Linear milestone %s: %w
- read labels for %s: %w
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/adadcea9a7c50d1f.
Report an issue: GitHub.