{"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":"exception","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/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/command/legacy/oplog.rs#L25-L61","documentation":"show_oplog throws this when a partial SHA supplied via `--since` cannot be resolved with rev_parse_single against the repository. GitButler rejects unresolvable prefixes so it does not silently filter the oplog from an unknown point.","triggerScenarios":"Running `but oplog --since <sha>` where the SHA prefix is a typo, refers to an object not present locally (unfetched GC'd object), or is not a valid revision syntax.","commonSituations":"Copy-pasting a SHA from another machine, referencing an oplog snapshot after history pruning/garbage collection, or truncating SHAs below the unique-prefix length.","solutions":["Run `but oplog` without --since to list available snapshot SHAs and copy a valid one","Verify the prefix resolves locally with `git rev-parse <sha_prefix>`","Fetch or restore missing objects if the SHA refers to history that was garbage-collected"],"exampleFix":"// before\nbut oplog --since abc12x  // typo'd prefix\n// after\nbut oplog                # list valid SHAs\nbut oplog --since abc123","handlingStrategy":"validation","validationCode":"// resolve the SHA prefix with git before passing --since\nconst sha = execSync(`git rev-parse ${prefix}`).toString().trim();\nif (!/^[0-9a-f]{40}$/.test(sha)) throw new Error(`Invalid SHA: ${prefix}`);\nawait runBut(['oplog', '--since', sha]);","typeGuard":"function isValidShaPrefix(s: string): boolean {\n  return /^[0-9a-f]{4,40}$/.test(s);\n}","tryCatchPattern":"try {\n  await runBut(['oplog', '--since', prefix]);\n} catch (e) {\n  if (/No oplog entry found matching SHA/.test(e.message)) {\n    console.error('Unknown SHA; run `but oplog` to list valid snapshots');\n    return;\n  }\n  throw e;\n}","preventionTips":["Copy SHAs directly from `but oplog` output","Validate prefixes with `git rev-parse` before use","Avoid referencing oplog SHAs after history pruning/GC"],"tags":["cli","oplog","sha","revision-not-found"],"backgroundTag":"record-not-found","analyzedSha":"58e5313667b857ef39a730e380af31816a7b1768","analyzedAt":"2026-09-18T06:50:32.052Z","contentChangedAt":"2026-09-18T06:50:32.052Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}