gitbutlerapp/gitbutler · error
object for prefix exists
Error message
object for prefix exists
What it means
A panic (expect) in but-debug's graph command: gix's lookup_prefix() returned Ok(None) for a --limit-extension prefix, meaning no object in the object database starts with that hex prefix. The debug tool assumes passed prefixes exist and aborts otherwise.
Solutions
- Confirm the object exists: `git rev-parse <prefix>` in the same repository; use its output as the value.
- Run the debug command from the correct repository/worktree.
- If the repo is shallow, fetch more history (`git fetch --unshallow` or deepen) so the object is present.
Example fix
# before but debug graph --limit-extension 4c1f0ab # no such object here # after git rev-parse --verify 4c1f0ab && but debug graph --limit-extension $(git rev-parse --short 4c1f0ab)
Defensive patterns
Strategy: validation
Validate before calling
# verify the prefix resolves to an object before the debug run
git rev-parse --verify --quiet "${EXT}^{commit}" >/dev/null || { echo "no object for prefix $EXT" >&2; exit 2; } Prevention
- Only pass prefixes you obtained from this repository (rev-parse, log output).
- Deepen shallow clones before debugging old history.
- Run debug commands from the intended worktree.
When it happens
Trigger: Running `but debug graph --limit-extension <hex>` where <hex> is valid hex but matches no object: wrong repository, truncated/garbled hash, or an object that only exists in a different clone.
Common situations: Copying a hash from a different repo/PR/fork; a hash from before a shallow-clone boundary; case-sensitive typos that still form valid hex; running the command in the wrong worktree.
Related errors
- the prefix is unambiguous
- valid hex prefix
- BUG: It should not be possible to omit sources
- implement list and call recursively
- Target ref ' ' resolved from ' ' is not a remote-tracking…
AI-assisted analysis of gitbutlerapp/gitbutler@caf1f223d3 (2026-08-20).
Data as JSON: /api/errors/b653560c029083f9.
Report an issue: GitHub.
Appendix: source
Thrown at crates/but-debug/src/command/graph.rs:68
.map(|rev_spec| repo.rev_parse_single(rev_spec))
.transpose()?
.map(|id| id.detach());
let opts = but_graph::init::Options {
extra_target_commit_id: extra_target,
collect_tags: true,
hard_limit: graph_args.hard_limit,
commits_limit_hint: graph_args.limit.flatten(),
commits_limit_recharge_location: graph_args
.limit_extension
.iter()
.map(|short_hash| {
repo.objects
.lookup_prefix(
gix::hash::Prefix::from_hex(short_hash).expect("valid hex prefix"),
None,
)
.unwrap()
.expect("object for prefix exists")
.expect("the prefix is unambiguous")
})
.collect(),
dangerously_skip_postprocessing_for_debugging: graph_args.no_post,
worktrees: false,
};
let graph = match graph_args.ref_name.as_deref() {
None => but_graph::Graph::from_head(
&repo,
&meta,
but_core::ref_metadata::ProjectMeta::default(),
&mut setup::debug_db()?,
opts,
),
Some(ref_name) => {
let mut reference = repo.find_reference(ref_name)?;
let id = reference.peel_to_id()?;View on GitHub (pinned to caf1f223d3)