{"record":{"id":"f10e8dc2fcb00092","repo":"astrid-runtime/astrid","slug":"unsupported-mcp-readiness-format-other-use-ho","errorCode":null,"errorMessage":"unsupported MCP readiness format '{other}'; use hook, pretty, or json","messagePattern":"unsupported MCP readiness format '(.+?)'; use hook, pretty, or json","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-cli/src/commands/mcp/lifecycle.rs","lineNumber":756,"sourceCode":"    remove_gateway_startup_lease(None).context(\"shutdown stage gateway.startup_cleanup\")?;\n    drop(lifecycle);\n    Ok(())\n}\n\n#[derive(Debug, Clone, Copy, PartialEq, Eq)]\nenum ReadyFormat {\n    Hook,\n    Pretty,\n    Json,\n}\n\nimpl ReadyFormat {\n    fn parse(value: &str) -> Result<Self> {\n        match value {\n            \"hook\" => Ok(Self::Hook),\n            \"pretty\" => Ok(Self::Pretty),\n            \"json\" => Ok(Self::Json),\n            other => anyhow::bail!(\n                \"unsupported MCP readiness format '{other}'; use hook, pretty, or json\"\n            ),\n        }\n    }\n}\n\nfn emit_ready(format: ReadyFormat, record: &GatewayReady) -> Result<()> {\n    match format {\n        ReadyFormat::Hook => println!(\"ready\"),\n        ReadyFormat::Pretty => println!(\"MCP gateway ready (principal {})\", record.principal),\n        ReadyFormat::Json => println!(\"{}\", serde_json::to_string(record)?),\n    }\n    Ok(())\n}\n\nfn spawn_gateway(principal: &PrincipalId) -> Result<()> {\n    let executable =\n        std::env::current_exe().context(\"failed to resolve the Astrid CLI executable\")?;","sourceCodeStart":738,"sourceCodeEnd":774,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-cli/src/commands/mcp/lifecycle.rs#L738-L774","documentation":"ReadyFormat::parse converts the --format flag of `astrid mcp ready` into the ReadyFormat enum. It only accepts the literal strings hook, pretty, or json; any other value is rejected with this error listing the valid choices.","triggerScenarios":"Calling `astrid mcp ready --format <value>` (or the parse API) with any string other than exactly \"hook\", \"pretty\", or \"json\", including typos like \"JSON\", \"hooks\", or \"text\".","commonSituations":"Case-sensitive typo (JSON instead of json); assuming an undocumented format exists; scripting that interpolates a config value not in the allowed set; older/newer CLI versions with a different format vocabulary.","solutions":["Use one of the exact lowercase values: hook, pretty, or json.","Run `astrid mcp ready --help` to confirm the accepted formats for your installed version.","If a wrapper script supplies the format, whitelist it to {hook,pretty,json} before invoking the CLI.","Upgrade/downgrade the CLI if you need a format introduced in a different version."],"exampleFix":"// before\nastrid mcp ready --format JSON\n// after\nastrid mcp ready --format json","handlingStrategy":"validation","validationCode":"const READY_FORMATS: [&str; 3] = [\"hook\", \"pretty\", \"json\"];\nfn valid_format(f: &str) -> Result<(), String> {\n    if READY_FORMATS.contains(&f) { Ok(()) } else { Err(format!(\"format '{f}' not in {{hook, pretty, json}}\")) }\n}","typeGuard":"fn is_ready_format(v: &str) -> bool { matches!(v, \"hook\" | \"pretty\" | \"json\") }","tryCatchPattern":"match ready_format.parse() {\n    Ok(fmt) => run_ready(fmt),\n    Err(e) if e.to_string().contains(\"unsupported MCP readiness format\") =>\n        eprintln!(\"{e}; pass --format hook|pretty|json\"),\n    Err(e) => eprintln!(\"{e:#}\"),\n}","preventionTips":["Use tab-completion or constant values instead of hand-typed format strings","Remember the match is case-sensitive: use lowercase json/pretty/hook","Whitelist formats in wrapper scripts","Check --help for the accepted values on your CLI version"],"tags":["cli","argument-parsing","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"affd8760f44190dbdfbec23403f4c4b642c33112","analyzedAt":"2026-09-09T21:28:12.402Z","contentChangedAt":"2026-09-09T21:28:12.402Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}