{"record":{"id":"f85cf7eb8aa003e9","repo":"warpdotdev/warp","slug":"whoami-does-not-support-output-format-ndjson","errorCode":null,"errorMessage":"`whoami` does not support `--output-format ndjson`","messagePattern":"`whoami` does not support `--output-format ndjson`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"app/src/ai/agent_sdk/admin.rs","lineNumber":246,"sourceCode":"                OutputFormat::Json => {\n                    match serde_json::to_string(&info).context(\"whoami output should serialize\") {\n                        Ok(json) => println!(\"{json}\"),\n                        Err(err) => {\n                            ctx.terminate_app(TerminationMode::ForceTerminate, Some(Err(err)));\n                            return;\n                        }\n                    }\n                }\n                OutputFormat::Pretty => {\n                    println!(\"{}\", info.pretty(principal_type));\n                }\n                OutputFormat::Text => {\n                    println!(\"{}:{}\", info.principal_type, info.uid);\n                }\n                OutputFormat::Ndjson => {\n                    ctx.terminate_app(\n                        TerminationMode::ForceTerminate,\n                        Some(Err(anyhow::anyhow!(\n                            \"`whoami` does not support `--output-format ndjson`\"\n                        ))),\n                    );\n                    return;\n                }\n            }\n\n            ctx.terminate_app(TerminationMode::ForceTerminate, None);\n        });\n    });\n\n    Ok(())\n}\n\n/// Log out of Warp using the same logic as the app.\npub fn logout(ctx: &mut AppContext) -> Result<()> {\n    let auth_state = AuthStateProvider::as_ref(ctx).get();\n    if !auth_state.is_logged_in() {","sourceCodeStart":228,"sourceCodeEnd":264,"githubUrl":"https://github.com/warpdotdev/warp/blob/e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc/app/src/ai/agent_sdk/admin.rs#L228-L264","documentation":"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.","triggerScenarios":"Running whoami with --output-format ndjson (the only unsupported variant of the four).","commonSituations":"Scripts that pass one shared --output-format ndjson flag to every subcommand; CI pipelines that normalize all output to ndjson.","solutions":["Use --output-format json, which prints one JSON object you can parse with jq","Use text (principal:uid) or pretty for human-readable output","In scripts, special-case whoami when forwarding a global output-format flag"],"exampleFix":"# before\nwhoami --output-format ndjson\n# after\nwhoami --output-format json","handlingStrategy":"validation","validationCode":"if matches!(output_format, OutputFormat::Ndjson) {\n    // whoami cannot emit ndjson; switch to Json before dispatching the subcommand\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep a per-subcommand allowlist of output formats when forwarding a global --output-format flag","Default scripts to json for single-record commands like whoami"],"tags":["cli","output-format","whoami","usage"],"backgroundTag":null,"analyzedSha":"e72fd7aacbbb2236d9b3be2aad7e7178fe94b4bc","analyzedAt":"2026-08-16T08:27:25.381Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}