warpdotdev/warp · error · AgentDriverError::ConfigBuildFailed
Failed to write temp file '{prefix}': {e}
Error message
Failed to write temp file '{prefix}': {e} What it means
Wrapped as AgentDriverError::ConfigBuildFailed when write_all on the just-created NamedTempFile fails. Creation succeeded, so this is a mid-write failure: ENOSPC when the disk fills while writing the prompt content, EIO on failing storage, or the temp file being invalidated (dir cleanup races, sandbox revocation).
Source
Thrown at app/src/ai/agent_sdk/driver/harness/mod.rs:580
///
/// Used by third-party harnesses to stage prompts / system prompts on disk
/// before launching the CLI, avoiding shell-quoting issues with complex input.
pub(super) fn write_temp_file(
prefix: &str,
content: &str,
suffix: &str,
) -> Result<NamedTempFile, AgentDriverError> {
let mut file = tempfile::Builder::new()
.prefix(prefix)
.suffix(suffix)
.tempfile()
.map_err(|e| {
AgentDriverError::ConfigBuildFailed(anyhow::anyhow!(
"Failed to create temp file '{prefix}': {e}"
))
})?;
file.write_all(content.as_bytes()).map_err(|e| {
AgentDriverError::ConfigBuildFailed(anyhow::anyhow!(
"Failed to write temp file '{prefix}': {e}"
))
})?;
Ok(file)
}
/// Upload a [`SerializedBlock`] as the JSON block snapshot for a third-party harness conversation.
pub(crate) async fn upload_block_snapshot(
client: &dyn HarnessSupportClient,
conversation_id: AIConversationId,
block: SerializedBlock,
) -> Result<()> {
log::info!("Uploading block snapshot for CLI agent to conversation {conversation_id}");
let target = client
.get_block_snapshot_upload_target(&conversation_id)
.await
.with_context(|| {
format!("Unable to get block upload slot for conversation {conversation_id}")View on GitHub (pinned to e72fd7aacb)
Solutions
- Free temp-directory disk space (df -h $TMPDIR) and retry — ENOSPC is the dominant cause given creation already succeeded.
- Move TMPDIR to a volume with ample free space for prompt-sized writes.
- If using network-backed /tmp, switch to local storage to avoid EIO/flush failures mid-write.
Example fix
# before # disk nearly full: tempfile created, write_all fails with ENOSPC warp agent run … # after df -h /tmp && docker system prune -a # or: export TMPDIR=/data/tmp with free space warp agent run …
Defensive patterns
Strategy: try-catch
Validate before calling
let needed = content.len() as u64 + 1024;
let avail = fs2::available_space(&std::env::temp_dir())?;
anyhow::ensure!(avail > needed, "temp dir needs ~{} bytes free for prompt staging", needed); Try / catch
match write_temp_file(prefix, content, suffix) {
Err(AgentDriverError::ConfigBuildFailed(err)) if err.to_string().contains("Failed to write temp file") => {
// ENOSPC mid-write: free space or switch TMPDIR, then retry once
std::env::set_var("TMPDIR", alternate_dir_with_space());
write_temp_file(prefix, content, suffix)
}
rest => rest,
} Prevention
- Keep temp volume headroom larger than the largest prompt/system prompt you stage.
- Prefer local disk over NFS-backed /tmp for temp files to avoid mid-write EIO.
- Since creation succeeded but the write failed, suspect ENOSPC first and check df -h $TMPDIR.
When it happens
Trigger: Calling write_temp_file with large prompt/system-prompt content on a nearly-full disk — the create succeeds, then write_all hits ENOSPC partway; also flaky network-backed temp mounts (NFS /tmp) or macOS periodic tmp cleaners racing the write.
Common situations: Very large system prompts or context dumps exhausting remaining disk; CI containers with small overlay filesystems; temp dirs on network storage that drops mid-write.
Related errors
- Failed to create temp file '{prefix}': {e}
- Failed to read attachment file '{}': {e}
- Failed to materialize conversation: {e}
- source_config_unavailable
- Can't read files when not on a local filesystem
AI-assisted analysis of warpdotdev/warp@e72fd7aacb (2026-08-16).
Data as JSON: /api/errors/c38a3914b35f3bdd.
Report an issue: GitHub.