{"record":{"id":"0ae56a2491731f74","repo":"GitoxideLabs/gitoxide","slug":"message","errorCode":null,"errorMessage":"{message}","messagePattern":"\\{message\\}","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"gix-tix/src/lib.rs","lineNumber":5112,"sourceCode":"fn prepare_file_diff_with_repository(\n    repository: &gix::Repository,\n    change: &FileChange,\n    path: &PathChange,\n) -> Result<FileDiff> {\n    match prepare_file_diff_content(repository, change, path, false)? {\n        PreparedFileDiff::External(command, _) => Ok(FileDiff::External(command)),\n        PreparedFileDiff::BuiltIn(diff, _) => prepare_pager(repository, diff),\n    }\n}\n\nfn prepare_file_diff_content(\n    repository: &gix::Repository,\n    change: &FileChange,\n    path: &PathChange,\n    count_lines: bool,\n) -> Result<PreparedFileDiff> {\n    if let FileChange::Unavailable(message) = change {\n        anyhow::bail!(\"{message}\");\n    }\n    let global_command = repository\n        .config_snapshot()\n        .trusted_program(gix::config::tree::Diff::EXTERNAL)\n        .map(gix::path::os_string_into_bstring)\n        .transpose()\n        .context(\"external diff command is not representable on this platform\")?;\n    let mut resources = match change {\n        FileChange::Tree(_) => repository\n            .diff_resource_cache(\n                gix::diff::blob::pipeline::Mode::ToGitUnlessBinaryToTextIsPresent,\n                Default::default(),\n            )\n            .context(\"could not initialize file diff\")?,\n        FileChange::Worktree { .. } => worktree_diff_cache(\n            repository,\n            gix::diff::blob::pipeline::Mode::ToGitUnlessBinaryToTextIsPresent,\n        )?","sourceCodeStart":5094,"sourceCodeEnd":5130,"githubUrl":"https://github.com/GitoxideLabs/gitoxide/blob/e73179060badf27222d790981fac3f84c1830a7e/gix-tix/src/lib.rs#L5094-L5130","documentation":"The file change being diffed carries no usable content (e.g. the file was untracked, replaced by a submodule change, or its blob could not be loaded), and the FileChange enum conveys that as a message string. The diff preparation propagates it as a bail with that message. It is a controlled early-exit, not an internal failure.","triggerScenarios":"Calling the file-diff preparation (prepare of PreparedFileDiff) with a FileChange::Unavailable variant, which occurs when git reports an unavailable/irrelevant change for the path (e.g. type change to submodule, intent-to-add, missing object).","commonSituations":"Diffing a working-tree status entry for a submodule or untracked-but-staged path; repository with missing blob objects; status output including FileChange::Unavailable entries.","solutions":["Match on FileChange::Unavailable in the caller and skip or render a placeholder instead of asking for a diff.","Verify the object exists (gix::Repository::find_object) before requesting a diff for the path.","For submodule/type changes, use a change-type presentation rather than a line diff.","Repair the repository (git fsck) if the blob is genuinely missing."],"exampleFix":"// before\nlet prepared = prepare_file_diff(repo, &change, &path, true)?;\n// after\nlet prepared = match &change {\n    FileChange::Unavailable(msg) => { eprintln!(\"skipping: {msg}\"); continue; }\n    _ => prepare_file_diff(repo, &change, &path, true)?,\n};","handlingStrategy":"type-guard","validationCode":"if matches!(change, FileChange::Unavailable(_)) { /* skip diff */ }","typeGuard":"fn is_unavailable(change: &FileChange) -> bool {\n    matches!(change, FileChange::Unavailable(_))\n}","tryCatchPattern":"match prepare_file_diff(repo, &change, &path, true) {\n    Err(err) if err.to_string() == unavailable_msg => skip_or_placeholder(),\n    other => other?,\n}","preventionTips":["Filter FileChange::Unavailable entries out before batch diffing.","Check object availability with find_object before diffing.","Treat submodule and type changes as non-line-diffable and handle separately."],"tags":["diff","rust","unavailable-change"],"backgroundTag":"unsupported-operation","analyzedSha":"e73179060badf27222d790981fac3f84c1830a7e","analyzedAt":"2026-09-08T11:26:50.865Z","contentChangedAt":"2026-09-08T11:26:50.865Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}