gastownhall/beads · error
unsupported git object format %q
Error message
unsupported git object format %q
What it means
After querying `git rev-parse --show-object-format`, bd only accepts `sha1` (40-char OIDs) or `sha256` (64-char). Any other output triggers this error reporting the unexpected format string.
Source
Thrown at cmd/bd/worktree_cmd.go:1842
return matches, nil
}
func repositoryObjectIDLength(
ctx context.Context,
git *worktreeRemovalGit,
executionRoot string,
) (int, error) {
output, err := git.output(ctx, executionRoot, "rev-parse", "--show-object-format")
if err != nil {
return 0, fmt.Errorf("failed to determine repository object format: %w", err)
}
switch strings.TrimSpace(string(output)) {
case "sha1":
return 40, nil
case "sha256":
return 64, nil
default:
return 0, fmt.Errorf("unsupported git object format %q", strings.TrimSpace(string(output)))
}
}
func isHexObjectID(value string, length int) bool {
if len(value) != length {
return false
}
for _, character := range value {
if character >= '0' && character <= '9' ||
character >= 'a' && character <= 'f' ||
character >= 'A' && character <= 'F' {
continue
}
return false
}
return true
}
View on GitHub (pinned to 71377f2769)
Solutions
- Check `git rev-parse --show-object-format` output directly; it must print `sha1` or `sha256`
- Remove any git wrapper/shim that adds extra output
- Reinstall a standard git build
- Upgrade git if using a nonstandard hash algorithm build
Example fix
// diagnose git rev-parse --show-object-format # should print: sha1 // fix: remove wrapper emitting extra lines which git && cat $(which git)
Defensive patterns
Strategy: validation
Validate before calling
// shell pre-check fmt=$(git rev-parse --show-object-format 2>/dev/null) case "$fmt" in sha1|sha256) ;; *) echo "unexpected object format: '$fmt'" ;; esac
Prevention
- Use stock git binaries, not wrapper scripts that add output
- Confirm the repo's extensions.objectFormat is sha1 or sha256
- Re-clone if the repository metadata is corrupt
When it happens
Trigger: git returns an unexpected object-format value — empty output (command partially failed but exit 0), future/unknown hash algorithms, or whitespace/garbage output from a shimmed git binary.
Common situations: Wrapper scripts around `git` that emit extra output; experimental git builds; an empty repository where output is blank.
Related errors
- auto-export: git add failed: %w
- failed to read .gitignore: %w
- failed to write .gitignore: %w
- not in a git repository
- registered worktree not found: %s
AI-assisted analysis of gastownhall/beads@71377f2769 (2026-08-30).
Data as JSON: /api/errors/b91eccfd64422dad.
Report an issue: GitHub.