{"record":{"id":"d9d49c5986fd2cef","repo":"gitbutlerapp/gitbutler","slug":"no-oplog-entry-found-matching-sha-sha-prefix","errorCode":null,"errorMessage":"No oplog entry found matching SHA: {sha_prefix}","messagePattern":"No oplog entry found matching SHA: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/command/legacy/oplog.rs","lineNumber":43,"sourceCode":"        }\n    }\n}\n\npub(crate) fn show_oplog(\n    ctx: &mut but_ctx::Context,\n    out: &mut OutputChannel,\n    since: Option<&str>,\n    filter: Option<OplogFilter>,\n) -> anyhow::Result<()> {\n    // Convert filter to include_kind parameter for the API\n    let include_kind = filter.map(|f| f.to_include_kinds());\n\n    // Resolve partial SHA to full SHA using rev_parse if provided\n    let since_sha = if let Some(sha_prefix) = since {\n        let repo = ctx.repo.get()?;\n        let resolved = repo\n            .rev_parse_single(sha_prefix)\n            .map_err(|_| anyhow::anyhow!(\"No oplog entry found matching SHA: {sha_prefix}\"))?;\n        Some(resolved.detach())\n    } else {\n        None\n    };\n\n    let snapshots = but_api::legacy::oplog::snapshots_iter(ctx, since_sha, None, include_kind)?\n        .take(20)\n        .collect::<anyhow::Result<Vec<_>>>()?;\n\n    if snapshots.is_empty() {\n        if let Some(out) = out.for_json() {\n            out.write_value(&snapshots)?;\n        } else if let Some(out) = out.for_human() {\n            writeln!(out, \"No operations found in history.\")?;\n        }\n        return Ok(());\n    }\n","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/caf1f223d3cfb94488c9198ad34487c6006c648f/crates/but/src/command/legacy/oplog.rs#L25-L61","documentation":"`but oplog --since <sha_prefix>` maps the prefix to a full oid with `repo.rev_parse_single(sha_prefix)`; any failure there (unknown object, ambiguous prefix, malformed input) is flattened into this message. Despite the wording, it means git could not resolve the revision in this repository at all — the oplog lookup is never reached. The resolved oid would otherwise be the lower bound for `snapshots_iter`.","triggerScenarios":"Passing `--since` with a typo'd SHA, a prefix too short to be unique, an object id from a different repo/clone, or non-SHA input; `rev_parse_single` errors and the closure emits this anyhow error.","commonSituations":"SHA copied from another machine's logs; prefix truncated during copy-paste; shallow or partial clone missing the object; reflog-style input like HEAD@{2} where a raw sha is expected.","solutions":["Validate the input yourself: `git rev-parse <sha_prefix>` — if git errors, but will too","Use the full 40-char SHA from `but oplog` output or `git log`","Lengthen an ambiguous prefix until `git rev-parse` returns a single oid","Omit `--since` to list the latest snapshots regardless of bound"],"exampleFix":"# before\nbut oplog --since abc123\n# error: No oplog entry found matching SHA: abc123\n\n# after\ngit rev-parse abc123                      # verify it resolves; grab the full sha\nbut oplog --since \"$(git rev-parse abc123)\"","handlingStrategy":"validation","validationCode":"# Resolve the --since bound before handing it to but\nfull_sha=$(git rev-parse --verify \"${since}^{commit}\") || { echo \"bad revision: $since\" >&2; exit 1; }\nbut oplog --since \"$full_sha\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always `git rev-parse` unknown input before passing it as --since","Prefer full SHAs in scripts; abbreviations can become ambiguous as the repo grows","Remember the oplog only knows commits that exist in this repository"],"tags":["oplog","git-revision","rev-parse","sha"],"backgroundTag":"git-revision-not-found","analyzedSha":"caf1f223d3cfb94488c9198ad34487c6006c648f","analyzedAt":"2026-08-20T07:55:40.983Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}