{"record":{"id":"ed819ca7841d8250","repo":"gastownhall/beads","slug":"failed-to-determine-repository-object-format-w","errorCode":null,"errorMessage":"failed to determine repository object format: %w","messagePattern":"failed to determine repository object format: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/bd/worktree_cmd.go","lineNumber":1834,"sourceCode":"\t\t\tmatchSet[ref] = struct{}{}\n\t\t}\n\t}\n\tmatches := make([]string, 0, len(matchSet))\n\tfor ref := range matchSet {\n\t\tmatches = append(matches, ref)\n\t}\n\tsort.Strings(matches)\n\treturn matches, nil\n}\n\nfunc repositoryObjectIDLength(\n\tctx context.Context,\n\tgit *worktreeRemovalGit,\n\texecutionRoot string,\n) (int, error) {\n\toutput, err := git.output(ctx, executionRoot, \"rev-parse\", \"--show-object-format\")\n\tif err != nil {\n\t\treturn 0, fmt.Errorf(\"failed to determine repository object format: %w\", err)\n\t}\n\tswitch strings.TrimSpace(string(output)) {\n\tcase \"sha1\":\n\t\treturn 40, nil\n\tcase \"sha256\":\n\t\treturn 64, nil\n\tdefault:\n\t\treturn 0, fmt.Errorf(\"unsupported git object format %q\", strings.TrimSpace(string(output)))\n\t}\n}\n\nfunc isHexObjectID(value string, length int) bool {\n\tif len(value) != length {\n\t\treturn false\n\t}\n\tfor _, character := range value {\n\t\tif character >= '0' && character <= '9' ||\n\t\t\tcharacter >= 'a' && character <= 'f' ||","sourceCodeStart":1816,"sourceCodeEnd":1852,"githubUrl":"https://github.com/gastownhall/beads/blob/71377f276968b452ee607177637970a4ff888584/cmd/bd/worktree_cmd.go#L1816-L1852","documentation":"bd determines the repository's hash length by running `git rev-parse --show-object-format` (sha1 → 40 hex chars, sha256 → 64). If that command fails, the error is wrapped so the caller knows full-OID detection could not be performed.","triggerScenarios":"`git rev-parse --show-object-format` exits non-zero — very old git (< 2.22) that lacks the flag, running outside a repository, or a broken git install.","commonSituations":"Old git versions on macOS/CentOS that predate `--show-object-format`; bare or corrupted repo; git not on PATH.","solutions":["Upgrade git to >= 2.22 which supports `--show-object-format`","Run `git rev-parse --show-object-format` manually to see the raw error","Ensure you are inside a valid git repository","Check `git --version` and PATH configuration"],"exampleFix":"// before: git 2.17 (flag unsupported)\n// after\ngit --version  # ensure >= 2.22\nbrew upgrade git  # or apt-get install -y git","handlingStrategy":"retry","validationCode":"// shell pre-check\ngit rev-parse --show-object-format >/dev/null 2>&1 || echo \"git too old (<2.22) or not in a repo\"","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"object format\") {\n    // upgrade git >= 2.22, then retry the command\n}","preventionTips":["Require git >= 2.22 in your environment/setup docs","Verify `git rev-parse --show-object-format` works in CI before invoking bd","Keep git installations current on macOS/Linux images"],"tags":["git","object-format","version-compat","subprocess"],"backgroundTag":"git-command-failed","analyzedSha":"71377f276968b452ee607177637970a4ff888584","analyzedAt":"2026-08-30T18:55:39.744Z","schemaVersion":2},"datasetVersion":"2026-08-30T23:17:21.991Z"}