openai/codex · error · anyhow::Error
No diff turn found
Error message
No diff turn found
What it means
Bail in apply_diff_from_task: the fetched task response has no current_diff_task_turn, meaning the backend task has not produced (or no longer exposes) a diff turn to apply. There is nothing to apply, so the apply command stops with this error instead of guessing.
Solutions
- Wait until the task has produced a diff turn, then re-run the apply command
- Check the task id is correct and the task is of a kind that generates diffs
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at codex-rs/chatgpt/src/apply_command.rs:44 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of openai/codex@339751715c (2026-08-25).
Data as JSON: /api/errors/f8b75a84a6d38894.
Report an issue: GitHub.
Appendix: source
Thrown at codex-rs/chatgpt/src/apply_command.rs:44
let config = Config::load_with_cli_overrides(
apply_cli
.config_overrides
.parse_overrides()
.map_err(anyhow::Error::msg)?,
)
.await?;
let task_response = get_task(&config, apply_cli.task_id).await?;
apply_diff_from_task(task_response, cwd).await
}
pub async fn apply_diff_from_task(
task_response: GetTaskResponse,
cwd: Option<PathBuf>,
) -> anyhow::Result<()> {
let diff_turn = match task_response.current_diff_task_turn {
Some(turn) => turn,
None => anyhow::bail!("No diff turn found"),
};
let output_diff = diff_turn.output_items.iter().find_map(|item| match item {
OutputItem::Pr(PrOutputItem { output_diff }) => Some(output_diff),
_ => None,
});
match output_diff {
Some(output_diff) => apply_diff(&output_diff.diff, cwd).await,
None => anyhow::bail!("No PR output item found"),
}
}
async fn apply_diff(diff: &str, cwd: Option<PathBuf>) -> anyhow::Result<()> {
let cwd = cwd.unwrap_or(std::env::current_dir().unwrap_or_else(|_| std::env::temp_dir()));
let req = ApplyGitRequest {
cwd,
diff: diff.to_string(),
revert: false,
preflight: false,View on GitHub (pinned to 339751715c)