{"record":{"id":"8dc27cc10d689693","repo":"gitbutlerapp/gitbutler","slug":"commit-is-a-remote-commit","errorCode":null,"errorMessage":"{commit} is a remote commit","messagePattern":"(.+?) is a remote commit","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/utils/diff_rendering.rs","lineNumber":818,"sourceCode":"pub fn render_committed_file(\n    commit: ObjectId,\n    path: BString,\n    ctx: &Context,\n    theme: &'static Theme,\n    id_gen: &mut IdGen<'_>,\n    options: Options,\n    out: &mut dyn DiffLineWriter,\n) -> anyhow::Result<()> {\n    let mut id_gen = id_gen.scoped(\"committed_file\");\n    let mut id_gen = id_gen.scoped(commit);\n\n    let id_map = IdMap::legacy_new_from_context(ctx)?;\n\n    let workspace_commit = match id_map.get_commit_by_id(commit)? {\n        CommitWithId::Local(commit) => commit,\n        // We don't resolve committed files for remote commits at this time, so there is no current\n        // use case for rendering a committed file from a remote commit.\n        CommitWithId::Remote(_) => bail!(\"{commit} is a remote commit\"),\n    };\n    let repo = ctx.repo.get()?;\n    let tree_changes = workspace_commit\n        .tree_changes_using_repo(&repo)?\n        .into_iter()\n        .filter(|tree_change| tree_change.inner.path == path)\n        .filter_map(|tree_change| {\n            let patch = tree_change\n                .inner\n                .unified_patch(&repo, ctx.settings.context_lines)\n                .ok()\n                .flatten()?;\n            Some((tree_change, patch))\n        })\n        .collect::<Vec<_>>();\n\n    if !options.skip_line_stats {\n        let mut line_stats = LineStats::default();","sourceCodeStart":800,"sourceCodeEnd":836,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/utils/diff_rendering.rs#L800-L836","documentation":"render_committed_file resolves a commit id through the IdMap and only supports local commits. Remote commits (e.g. commits known from origin that aren't in the local workspace) have no committed-file rendering implemented, so the function bails with '<commit> is a remote commit'. The comment notes this is a deliberate current limitation, not a bug.","triggerScenarios":"Calling render_committed_file (or a CLI command that renders a committed file diff) while passing a remote commit id — CommitWithId::Remote(_) from id_map.get_commit_by_id.","commonSituations":"Referencing a commit by an id that resolves to an upstream/remote-only commit; running file-diff commands against commits that exist only on the remote.","solutions":["Fetch the commit so it becomes local: `git fetch` / `but` fetch flow, then retry with the local commit.","Use the corresponding local commit id instead of the remote one.","As a fallback, view the remote commit with plain git: `git show <sha> -- <path>`."],"exampleFix":"// before\nbut diff <remote-commit-id> -- src/main.rs\n// after\ngit fetch origin && but diff <local-commit-id> -- src/main.rs","handlingStrategy":"validation","validationCode":"# ensure the commit exists locally before rendering its diff\ngit cat-file -e \"$SHA\"^{commit} 2>/dev/null || { git fetch origin; }","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Fetch before referencing remote-only commits","Use ids from local `but status` output, not remote refs","Fall back to `git show <sha>` for remote commits"],"tags":["git","unsupported-operation","remote-commit","cli"],"backgroundTag":"unsupported-operation","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"}