{"record":{"id":"5519ab244715dfe8","repo":"gastownhall/beads","slug":"registered-worktree-not-found-s","errorCode":null,"errorMessage":"registered worktree not found: %s","messagePattern":"registered worktree not found: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/worktree_cmd.go","lineNumber":911,"sourceCode":"\t\tif !matched {\n\t\t\tcontinue\n\t\t}\n\n\t\tduplicate := false\n\t\tfor _, existing := range matches {\n\t\t\tif sameWorktreePath(existing.path, worktree.path) {\n\t\t\t\tduplicate = true\n\t\t\t\tbreak\n\t\t\t}\n\t\t}\n\t\tif !duplicate {\n\t\t\tmatches = append(matches, worktree)\n\t\t}\n\t}\n\n\tswitch len(matches) {\n\tcase 0:\n\t\treturn registeredWorktree{}, fmt.Errorf(\"registered worktree not found: %s\", name)\n\tcase 1:\n\t\treturn matches[0], nil\n\tdefault:\n\t\tpaths := make([]string, 0, len(matches))\n\t\tfor _, match := range matches {\n\t\t\tpaths = append(paths, match.path)\n\t\t}\n\t\tsort.Strings(paths)\n\t\treturn registeredWorktree{}, fmt.Errorf(\n\t\t\t\"worktree name %q is ambiguous; use an absolute path (matches: %s)\",\n\t\t\tname,\n\t\t\tstrings.Join(paths, \", \"),\n\t\t)\n\t}\n}\n\ntype pinnedWorktreeTarget struct {\n\tpath                 string","sourceCodeStart":893,"sourceCodeEnd":929,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/worktree_cmd.go#L893-L929","documentation":"resolveRegisteredWorktree matches the user-supplied name/path against the bd worktree registry. When zero entries match, it returns this error instead of proceeding to removal. It means the identifier given to `bd worktree remove` does not correspond to any registered worktree.","triggerScenarios":"Calling `bd worktree remove <name>` where <name> is neither an absolute path matching a registered worktree, nor resolves (relative to current root or main root) to one, nor matches any registered worktree directory basename.","commonSituations":"Typo in the worktree name; worktree already removed or pruned; worktree created manually with `git worktree add` and never registered with bd; running from a different repo root so relative candidates resolve elsewhere; registry reset after a re-clone.","solutions":["Run `git worktree list` and `bd worktree list` to see registered worktrees, then use an exact registered name or path.","Pass the absolute path of the worktree instead of a basename: `bd worktree remove /abs/path/to/worktree`.","If the worktree was deleted manually, run `git worktree prune` and re-sync the bd registry, then retry.","Re-create the worktree with `bd worktree add <name>` if it never existed."],"exampleFix":"// before\nbd worktree remove feature-x\n// error: registered worktree not found: feature-x\n// after\nbd worktree list                    # find exact registered path\nbd worktree remove /repo/.worktrees/feature-x","handlingStrategy":"validation","validationCode":"const out = Bun.spawnSync([\"bd\", \"worktree\", \"list\", \"--json\"]);\nconst registered = JSON.parse(out.stdout.toString()).map(w => w.path);\nconst target = \"/repo/.worktrees/feature-x\";\nif (!registered.some(p => p === target || p.endsWith(\"/\" + target))) {\n  throw new Error(`worktree not registered: ${target}`);\n}","typeGuard":"function isRegistered(path, registered) {\n  return registered.some(w => w.path === path || w.name === path);\n}","tryCatchPattern":null,"preventionTips":["Always list registered worktrees (`bd worktree list`) before removing.","Use absolute paths instead of short names in scripts.","Register manually created worktrees with bd before referencing them.","Prune after manually deleting worktree directories."],"tags":["worktree","git","not-found","cli"],"backgroundTag":"worktree-not-found","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}