{"record":{"id":"176f1132a4c243cf","repo":"gastownhall/beads","slug":"not-found","errorCode":null,"errorMessage":"not found","messagePattern":"not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/state.go","lineNumber":45,"sourceCode":"// to choose — Reader.Get's issue-then-wisp lookup finds an ephemeral row on its\n// own, which is how the DIRECT route acquires wisp support it never had: it\n// used to call store.GetLabels, which only ever reads the durable table.\n//\n// Resolution stays a front-door job, and stays shared with `bd label`:\n// GetRequest.ID is exact by contract, so the partial-id affordance the direct\n// route offers cannot live below this line.\nfunc resolveStateTarget(ctx context.Context, issueID string) (*issueops.IssueDetails, error) {\n\tfullID, err := resolveLabelTarget(ctx, issueID)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treader, err := openIssueReader()\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tdetails, err := reader.Get(ctx, issueops.GetRequest{ID: fullID})\n\tif errors.Is(err, storage.ErrNotFound) {\n\t\treturn nil, errors.New(\"not found\")\n\t}\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn details, nil\n}\n\nvar stateCmd = &cobra.Command{\n\tUse:     \"state <issue-id> <dimension>\",\n\tGroupID: \"issues\",\n\tShort:   \"Query the current value of a state dimension\",\n\tLong: `Query the current value of a state dimension from an issue's labels.\n\nState labels follow the convention <dimension>:<value>, for example:\n  patrol:active\n  mode:degraded\n  health:healthy\n","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/state.go#L27-L63","documentation":"publicCreateValidationError is the internal wrapper that tags every deterministic public-create refusal with storage.ErrValidation: fmt.Errorf(\"%w: %w\", storage.ErrValidation, err). Callers use errors.Is(err, storage.ErrValidation) to distinguish caller mistakes (bad input, invalid relationships) from infrastructure failures, which are passed through unclassified.","triggerScenarios":"Any validation failure in ValidatePublicCreateRequest, PreparePublicCreateRequest, validatePublicCreateDependencies, or the deterministic-refusal branches of ClassifyPublicCreateError; the wrap happens at public_create.go:121.","commonSituations":"API consumers checking error types see ErrValidation unexpectedly when they sent malformed create requests; test authors asserting on error identity chain.","solutions":["Use errors.Is(err, storage.ErrValidation) to detect this class; then inspect the wrapped cause with errors.As/Unwrap for specifics.","Fix the request field the wrapped error names (ID length, dependency type, duplicate edge, etc.).","Do not retry: this is a deterministic input problem, not transient."],"exampleFix":"// before\nif err := store.ExecuteCreate(ctx, req); err != nil { log.Fatal(err) }\n// after\nif err := store.ExecuteCreate(ctx, req); err != nil {\n    if errors.Is(err, storage.ErrValidation) { return fmt.Errorf(\"invalid create request: %w\", err) }\n    return err\n}","handlingStrategy":"try-catch","validationCode":"if err := ValidatePublicCreateRequest(req); err != nil { return err } // pre-validate with the exported helper","typeGuard":"func isValidationErr(err error) bool { return errors.Is(err, storage.ErrValidation) }","tryCatchPattern":"err := store.ExecuteCreate(ctx, req)\nswitch {\ncase errors.Is(err, storage.ErrValidation):\n    // deterministic input refusal; inspect wrapped cause\ncase err != nil:\n    // infrastructure/commit error; safe to retry/log\n}","preventionTips":["Run ValidatePublicCreateRequest before ExecuteCreate.","Treat ErrValidation as non-retryable and surface to the caller.","Use errors.Unwrap loop / errors.As to extract the specific cause."],"tags":["go","storage","validation","error-wrapping"],"backgroundTag":"validation-error-wrapped","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}