{"record":{"id":"57954348c1e52be3","repo":"gastownhall/beads","slug":"merged-into-object-id-q-does-not-resolve-to-a-c","errorCode":null,"errorMessage":"--merged-into object ID %q does not resolve to a commit: %w","messagePattern":"--merged-into object ID %q does not resolve to a commit: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/worktree_cmd.go","lineNumber":1745,"sourceCode":"\t\treturn pinnedWorktreeComparator{}, fmt.Errorf(\n\t\t\t\"--merged-into value %q is ambiguous; use a full ref name or a non-ref full object ID (matches: %s)\",\n\t\t\tselector,\n\t\t\tstrings.Join(matches, \", \"),\n\t\t)\n\t}\n\tif len(matches) == 1 {\n\t\treturn pinWorktreeComparatorRef(ctx, git, executionRoot, target, selector, matches[0], true)\n\t}\n\tif !fullOID {\n\t\treturn pinnedWorktreeComparator{}, fmt.Errorf(\n\t\t\t\"--merged-into value %q does not name an existing unambiguous ref\",\n\t\t\tselector,\n\t\t)\n\t}\n\n\toid, err := resolveWorktreeCommitOID(ctx, git, executionRoot, selector)\n\tif err != nil {\n\t\treturn pinnedWorktreeComparator{}, fmt.Errorf(\n\t\t\t\"--merged-into object ID %q does not resolve to a commit: %w\",\n\t\t\tselector,\n\t\t\terr,\n\t\t)\n\t}\n\tif oid == target.headOID {\n\t\treturn pinnedWorktreeComparator{}, fmt.Errorf(\n\t\t\t\"--merged-into object ID %q is the target HEAD itself; use a ref or descendant commit that independently proves containment\",\n\t\t\tselector,\n\t\t)\n\t}\n\treturn pinnedWorktreeComparator{\n\t\tselector: selector,\n\t\texplicit: true,\n\t\toid:      oid,\n\t}, nil\n}\n","sourceCodeStart":1727,"sourceCodeEnd":1763,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/worktree_cmd.go#L1727-L1763","documentation":"After ref matching fails and the selector is treated as a full object ID, bd calls `resolveWorktreeCommitOID` to confirm it points at a commit. If `git rev-parse` fails or the object is not a commit, this wrapped error reports both the selector and the underlying git error.","triggerScenarios":"`--merged-into <full-oid>` where the OID does not exist in the repository, is malformed, or resolves to a non-commit object (tree, blob, tag object peeled to nothing).","commonSituations":"Copying an OID from a different repository; passing a tree or blob hash instead of a commit hash; truncated hash that was mistakenly assumed full-length; object pruned by `git gc`.","solutions":["Verify with `git cat-file -t <oid>` that the object exists and is a `commit`","Copy the OID again with `git rev-parse <ref>` from the same repository","Use a branch/ref name instead of a raw OID"],"exampleFix":"// before\nbd worktree remove --merged-into 4b825dc642cb6eb9a060e54bf8d69288fbee4904  # a tree\n// after\nbd worktree remove --merged-into $(git rev-parse refs/heads/main)  # a commit","handlingStrategy":"validation","validationCode":"// shell pre-check\ntype=$(git cat-file -t \"$OID\" 2>/dev/null || true)\n[ \"$type\" = \"commit\" ] || echo \"$OID is not a commit (got: $type)\"","typeGuard":null,"tryCatchPattern":"if err := runBd(); err != nil {\n    if strings.Contains(err.Error(), \"does not resolve to a commit\") {\n        // fall back to resolving a ref name instead of a raw OID\n    }\n}","preventionTips":["Generate OIDs with `git rev-parse <ref>` in the same repository","Confirm with `git cat-file -t` that the object is a commit","Prefer ref names over raw OIDs in scripts"],"tags":["git","cli","oid","object-resolution"],"backgroundTag":"invalid-git-object-id","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}