warpdotdev/warp · error

Streaming commands require `--output-format ndjson`

Error message

Streaming commands require `--output-format ndjson`

What it means

`ensure_stream_output_format` guards streaming agent-sdk subcommands. Streaming output writes one JSON record per event via `write_stream_record`, which only makes sense for NDJSON; any other `--output-format` (text/table/json) is rejected up front with this error instead of producing unparseable mixed output.

Source

Thrown at app/src/ai/agent_sdk/ambient.rs:1030

struct MessageWatchEvent {
    sequence: i64,
    message_id: String,
    sender_run_id: String,
    subject: String,
    body: String,
    occurred_at: String,
}

fn format_optional_timestamp(timestamp: Option<&str>) -> &str {
    timestamp.unwrap_or("-")
}

fn ensure_stream_output_format(output_format: OutputFormat) -> anyhow::Result<()> {
    if output_format == OutputFormat::Ndjson {
        return Ok(());
    }

    Err(anyhow!(
        "Streaming commands require `--output-format ndjson`"
    ))
}

fn stream_retry_backoff(failures: usize) -> Duration {
    let index = failures
        .saturating_sub(1)
        .min(STREAM_RETRY_BACKOFF_STEPS.len() - 1);
    Duration::from_secs(STREAM_RETRY_BACKOFF_STEPS[index])
}

fn write_stream_record<T: Serialize>(record: &T) -> anyhow::Result<()> {
    let mut stdout = std::io::stdout();
    super::output::write_json_line(record, &mut stdout)?;
    stdout.flush().context("unable to flush stdout")?;
    Ok(())
}

View on GitHub (pinned to e72fd7aacb)

Solutions

  1. Add `--output-format ndjson` to the streaming command
  2. Drop the streaming flag if you want human-readable/table output
  3. If you consume the output programmatically, switch the parser to read line-delimited JSON

Example fix

# before
warp agent tasks stream --output-format text
# after
warp agent tasks stream --output-format ndjson
Defensive patterns

Strategy: validation

Validate before calling

fn stream_format_ok(fmt: &OutputFormat) -> bool {
    matches!(fmt, OutputFormat::Ndjson)
}
// Reject other formats in wrappers before spawning the CLI, with a message pointing at --output-format ndjson.

Type guard

fn is_stream_compatible(fmt: &OutputFormat) -> bool {
    matches!(fmt, OutputFormat::Ndjson)
}

Prevention

When it happens

Trigger: Invoking a streaming subcommand (ambient agent stream/watch-style commands that call ensure_stream_output_format) with `--output-format` set to anything other than `ndjson`, or inheriting a non-ndjson default while requesting streaming.

Common situations: Copy-pasted command templates that use text output; CI wrappers defaulting to pretty output; scripts written for the non-streaming command reused for the streaming one; shell profiles or aliases that set --output-format globally.

Related errors


AI-assisted analysis of warpdotdev/warp@e72fd7aacb (2026-08-16). Data as JSON: /api/errors/044c7febdfc32a3b. Report an issue: GitHub.