warpdotdev/warp · warning

`whoami` does not support `--output-format ndjson`

Error message

`whoami` does not support `--output-format ndjson`

What it means

whoami's output-format match (app/src/ai/agent_sdk/admin.rs:243-251) handles Json, Pretty, and Text, but deliberately terminates with an error for Ndjson because whoami emits a single record and newline-delimited streaming JSON does not apply. The app is force-terminated with this message.

Source

Thrown at app/src/ai/agent_sdk/admin.rs:246

                OutputFormat::Json => {
                    match serde_json::to_string(&info).context("whoami output should serialize") {
                        Ok(json) => println!("{json}"),
                        Err(err) => {
                            ctx.terminate_app(TerminationMode::ForceTerminate, Some(Err(err)));
                            return;
                        }
                    }
                }
                OutputFormat::Pretty => {
                    println!("{}", info.pretty(principal_type));
                }
                OutputFormat::Text => {
                    println!("{}:{}", info.principal_type, info.uid);
                }
                OutputFormat::Ndjson => {
                    ctx.terminate_app(
                        TerminationMode::ForceTerminate,
                        Some(Err(anyhow::anyhow!(
                            "`whoami` does not support `--output-format ndjson`"
                        ))),
                    );
                    return;
                }
            }

            ctx.terminate_app(TerminationMode::ForceTerminate, None);
        });
    });

    Ok(())
}

/// Log out of Warp using the same logic as the app.
pub fn logout(ctx: &mut AppContext) -> Result<()> {
    let auth_state = AuthStateProvider::as_ref(ctx).get();
    if !auth_state.is_logged_in() {

View on GitHub (pinned to e72fd7aacb)

Solutions

  1. Use --output-format json, which prints one JSON object you can parse with jq
  2. Use text (principal:uid) or pretty for human-readable output
  3. In scripts, special-case whoami when forwarding a global output-format flag

Example fix

# before
whoami --output-format ndjson
# after
whoami --output-format json
Defensive patterns

Strategy: validation

Validate before calling

if matches!(output_format, OutputFormat::Ndjson) {
    // whoami cannot emit ndjson; switch to Json before dispatching the subcommand
}

Prevention

When it happens

Trigger: Running whoami with --output-format ndjson (the only unsupported variant of the four).

Common situations: Scripts that pass one shared --output-format ndjson flag to every subcommand; CI pipelines that normalize all output to ndjson.

Related errors


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