{"record":{"id":"64e2ed5e8dcf6886","repo":"gastownhall/beads","slug":"failed-to-resolve-s-w","errorCode":null,"errorMessage":"failed to resolve %s: %w","messagePattern":"failed to resolve (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/duplicate.go","lineNumber":82,"sourceCode":"\tCheckReadonly(\"duplicate\")\n\n\tevt := metrics.NewCommandEvent(\"duplicate\")\n\tdefer func() {\n\t\tif c := metrics.Global(); c != nil {\n\t\t\tc.CloseEventAndAdd(evt)\n\t\t}\n\t}()\n\n\tctx := getRootContext()\n\tstore := getStore()\n\tactor := getActor()\n\n\t// Resolve partial IDs\n\tvar duplicateID, canonicalID string\n\tvar err error\n\tduplicateID, err = utils.ResolvePartialID(ctx, store, args[0])\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to resolve %s: %w\", args[0], err)\n\t}\n\tcanonicalID, err = utils.ResolvePartialID(ctx, store, duplicateOf)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to resolve %s: %w\", duplicateOf, err)\n\t}\n\n\tif duplicateID == canonicalID {\n\t\treturn fmt.Errorf(\"cannot mark an issue as duplicate of itself\")\n\t}\n\n\t// Verify canonical issue exists\n\tvar canonical *types.Issue\n\tcanonical, err = store.GetIssue(ctx, canonicalID)\n\tif err != nil || canonical == nil {\n\t\treturn fmt.Errorf(\"canonical issue not found: %s\", canonicalID)\n\t}\n\n\t// Add a \"duplicates\" dependency edge (duplicate → canonical)","sourceCodeStart":64,"sourceCodeEnd":100,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/duplicate.go#L64-L100","documentation":"Wraps utils.ResolvePartialID failure for the DUPLICATE argument in 'bd duplicate <id> --duplicate-of <canonical>'. The partial/prefix ID supplied could not be resolved to exactly one issue in the store — typically because it is ambiguous, malformed, or no matching issue exists. The command aborts before touching any issues.","triggerScenarios":"Calling `bd duplicate <bad-id>` where the first positional argument is a typo, a full ID that doesn't exist, an ambiguous prefix matching multiple issues, or an empty/invalid ID string.","commonSituations":"Typing a prefix too short to be unique (e.g. 'bd-1' matching bd-10, bd-12...); referencing an issue from another repo/database; the issue was deleted; copy-pasting an ID from a different tracker.","solutions":["Run `bd list` or `bd show <prefix>` to find the correct full issue ID","Use a longer prefix so ResolvePartialID matches exactly one issue","Confirm you are in the right repo/database containing the issue","If the issue was deleted, recreate it or pick the correct duplicate candidate"],"exampleFix":"// before\n$ bd duplicate bd-1 --duplicate-of bd-42\nError: failed to resolve bd-1: ambiguous prefix matches 3 issues\n// after\n$ bd duplicate bd-123 --duplicate-of bd-42","handlingStrategy":"validation","validationCode":"fullID, err := utils.ResolvePartialID(ctx, store, args[0])\nif err != nil {\n    fmt.Fprintf(os.Stderr, \"duplicate target %q not found; run bd list to get exact IDs\\n\", args[0])\n    os.Exit(1)\n}","typeGuard":null,"tryCatchPattern":"dupID, err := utils.ResolvePartialID(ctx, store, args[0])\nif err != nil {\n    var notFound *NotFoundError\n    if errors.As(err, &notFound) { /* prompt user for correct ID */ }\n    return err\n}","preventionTips":["Copy full issue IDs from bd list/bd show instead of typing prefixes","Verify the issue exists in the current repo before duplicate","Use unique-length prefixes in scripts"],"tags":["cli","id-resolution","duplicate"],"backgroundTag":"issue-id-not-found","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}