{"record":{"id":"6970b031258581fe","repo":"gitbutlerapp/gitbutler","slug":"diff-specs","errorCode":null,"errorMessage":"{}","messagePattern":"\\{\\}","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/but/src/utils/diff_specs.rs","lineNumber":75,"sourceCode":"            CliId::PathPrefix {\n                id: _,\n                hunks,\n                source: _,\n            } => self.push_changes_from_path_prefix(hunks),\n            CliId::CommittedFile {\n                committed_file:\n                    CommittedFileId {\n                        commit_id,\n                        path,\n                        change_id: _,\n                    },\n                id: _,\n            } => self.push_changes_from_committed_file(*commit_id, path.as_ref()),\n            CliId::Branch(branch) => {\n                anyhow::bail!(\"Cannot compute diff specs for branch `{}`\", branch.name)\n            }\n            CliId::AnonymousSegment(segment) => {\n                anyhow::bail!(\"{}\", anonymous_segment_error(&segment.id))\n            }\n            CliId::Commit {\n                commit:\n                    CommitId {\n                        commit_id,\n                        change_id: _,\n                    },\n                id: _,\n            } => self.push_changes_from_commit(*commit_id),\n            CliId::Uncommitted { id: _ } => self.push_changes_from_uncommitted_area(),\n            // A worktree's uncommitted area is expanded into its files during\n            // resolution, so the builder only ever sees hunks that already come from\n            // its own repo. The reference holds no changes at all.\n            CliId::Worktree { name, .. } | CliId::WorktreeUncommitted { name, .. } => {\n                anyhow::bail!(\"Cannot compute diff specs for worktree `{name}`\")\n            }\n            CliId::Stack { .. } => {\n                anyhow::bail!(\"Cannot compute diff specs for stacks\")","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/gitbutlerapp/gitbutler/blob/58e5313667b857ef39a730e380af31816a7b1768/crates/but/src/utils/diff_specs.rs#L57-L93","documentation":"This is the catch-all error for `CliId::AnonymousSegment`: the given id resolved to an anonymous (unnamed) commit segment, and diff specs cannot be computed for it. The actual message text is produced by `anonymous_segment_error(&segment.id)`, which explains that the anonymous segment cannot be targeted.","triggerScenarios":"Calling an operation whose diff-spec building path hits `push_changes_from_id` with a `CliId::AnonymousSegment` id, e.g. passing an anonymous-segment id from `but status` to a diff-specs-backed command.","commonSituations":"Selecting the unnamed area between labeled commits in `but status`/TUI output and passing that id to a command; scripting with ids copied from a visualization that includes anonymous segments.","solutions":["Use the id of a named commit, hunk, or file instead of the anonymous segment id","Assign the anonymous changes to a commit/branch first, then reference that id","Re-run `but status` to identify the nearest concrete commit id"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if let CliId::AnonymousSegment(seg) = &id {\n    eprintln!(\"{} is an anonymous segment; pick a named commit/hunk/file id\", seg.id);\n    return Ok(());\n}","typeGuard":"fn is_anonymous_segment(id: &CliId) -> bool { matches!(id, CliId::AnonymousSegment(_)) }","tryCatchPattern":"if let Err(e) = cmd() { if e.to_string().contains(\"anonymous\") || is_segment_error(&e) { /* re-pick a concrete id */ } else { return Err(e); } }","preventionTips":["Reference only labeled commits/branches, not the unnamed segments between them","Assign anonymous changes to a commit before targeting them","Filter status output to concrete change ids when scripting"],"tags":["cli","anonymous-segment","diff"],"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"}