{"record":{"id":"adadcea9a7c50d1f","repo":"gastownhall/beads","slug":"failed-to-search-protos-w","errorCode":null,"errorMessage":"failed to search protos: %w","messagePattern":"failed to search protos: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/template.go","lineNumber":274,"sourceCode":"\tprotoID, err := utils.ResolvePartialID(ctx, s, input)\n\tif err == nil {\n\t\t// Verify it's a proto (has template label)\n\t\tissue, getErr := s.GetIssue(ctx, protoID)\n\t\tif getErr == nil && issue != nil {\n\t\t\tlabels, _ := s.GetLabels(ctx, protoID)\n\t\t\tfor _, label := range labels {\n\t\t\t\tif label == BeadsTemplateLabel {\n\t\t\t\t\treturn protoID, nil // Found a valid proto by ID\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\t// ID resolved but not a proto - continue to title search\n\t}\n\n\t// Strategy 2: Search for protos by title\n\tprotos, err := s.GetIssuesByLabel(ctx, BeadsTemplateLabel)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"failed to search protos: %w\", err)\n\t}\n\n\tvar matches []*types.Issue\n\tvar exactMatch *types.Issue\n\n\tfor _, proto := range protos {\n\t\t// Check for exact title match (case-insensitive)\n\t\tif strings.EqualFold(proto.Title, input) {\n\t\t\texactMatch = proto\n\t\t\tbreak\n\t\t}\n\t\t// Check for partial title match (case-insensitive)\n\t\tif strings.Contains(strings.ToLower(proto.Title), strings.ToLower(input)) {\n\t\t\tmatches = append(matches, proto)\n\t\t}\n\t}\n\n\tif exactMatch != nil {","sourceCodeStart":256,"sourceCodeEnd":292,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/template.go#L256-L292","documentation":"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).","triggerScenarios":"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.","commonSituations":"Dolt database in a bad state after an interrupted sync; embedded driver I/O error; permission problems reading the .beads database file.","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."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"pid, err := resolveProtoIDOrTitle(ctx, s, input)\nif err != nil {\n\tvar storageErr bool\n\tif strings.Contains(err.Error(), \"failed to search protos\") { storageErr = true }\n\t// distinguish storage failure from not-found/ambiguous and report accordingly\n\treturn err\n}","preventionTips":["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."],"tags":["storage","search","labels","template"],"backgroundTag":"proto-search-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}