{"record":{"id":"5cc77b10b69433a6","repo":"aaif-goose/goose","slug":"unsupported-format","errorCode":null,"errorMessage":"Unsupported format: {}","messagePattern":"Unsupported format: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/goose-cli/src/commands/session.rs","lineNumber":254,"sourceCode":"        Err(e) => {\n            return Err(anyhow::anyhow!(\n                \"Session '{}' not found or failed to read: {}\",\n                session_id,\n                e\n            ));\n        }\n    };\n\n    let output = match format.as_str() {\n        \"json\" => serde_json::to_string_pretty(&session)?,\n        \"yaml\" => serde_yaml::to_string(&session)?,\n        \"markdown\" => {\n            let conversation = session\n                .conversation\n                .ok_or_else(|| anyhow::anyhow!(\"Session has no messages\"))?;\n            export_session_to_markdown(conversation.user_visible_messages(), &session.name)\n        }\n        _ => return Err(anyhow::anyhow!(\"Unsupported format: {}\", format)),\n    };\n\n    #[cfg(feature = \"nostr\")]\n    if nostr {\n        if format != \"json\" {\n            return Err(anyhow::anyhow!(\n                \"Nostr session sharing only supports --format json\"\n            ));\n        }\n        if output_path.is_some() {\n            return Err(anyhow::anyhow!(\n                \"Nostr session sharing cannot be combined with --output\"\n            ));\n        }\n\n        let relays = nostr_share::resolve_relays(relays, Config::global());\n        let share = nostr_share::publish_session_json(&output, relays).await?;\n        println!(\"Session published to Nostr relays:\");","sourceCodeStart":236,"sourceCodeEnd":272,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose-cli/src/commands/session.rs#L236-L272","documentation":"The --format value of `goose session export` is a free String validated by this match, not by clap's value parser, so any string outside the exact set json|yaml|markdown reaches this arm. Matching is case-sensitive with no aliases (md, yml are rejected).","triggerScenarios":"`--format xml`, `--format md`, `--format JSON` (uppercase), or a typo like `--format jsson`.","commonSituations":" muscle memory from other tools (md/yml abbreviations); copy-pasting format names from outdated docs; shell scripts parameterizing the format with an unvalidated variable.","solutions":["Use exactly one of: json, yaml, markdown (lowercase)","If combining with --nostr, use json (see the separate nostr format error)","Parameterize scripts through a validated allowlist of the three values"],"exampleFix":"# before\ngoose session export <id> --format md\n# after\ngoose session export <id> --format markdown","handlingStrategy":"validation","validationCode":"assert!(is_supported_export_format(&format), \"format must be json, yaml, or markdown\");\nhandle_session_export(id, out, format, nostr, relays).await?;","typeGuard":"fn is_supported_export_format(f: &str) -> bool {\n    matches!(f, \"json\" | \"yaml\" | \"markdown\")\n}","tryCatchPattern":null,"preventionTips":["Route the --format value through an allowlist constant shared by all your scripts","Use lowercase exact spellings; no md/yml aliases exist"],"tags":["session","export","argument-validation","cli"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}