{"record":{"id":"6e2752ab3190c565","repo":"aaif-goose/goose","slug":"nostr-session-sharing-cannot-be-combined-with-ou","errorCode":null,"errorMessage":"Nostr session sharing cannot be combined with --output","messagePattern":"Nostr session sharing cannot be combined with --output","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/goose-cli/src/commands/session.rs","lineNumber":265,"sourceCode":"        \"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:\");\n        for relay in &share.relays {\n            println!(\"- {}\", relay);\n        }\n        println!(\"\\nShare link:\");\n        println!(\"{}\", share.deeplink);\n        return Ok(());\n    }\n    #[cfg(not(feature = \"nostr\"))]\n    if nostr {\n        return Err(anyhow::anyhow!(\"goose was not built with nostr support\"));\n    }","sourceCodeStart":247,"sourceCodeEnd":283,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/crates/goose-cli/src/commands/session.rs#L247-L283","documentation":"--nostr publishes the rendered session to Nostr relays and prints a share link; --output writes the same bytes to a local file. The two destinations are mutually exclusive by design and this check rejects the combination before publishing.","triggerScenarios":"`goose session export <id> --nostr --output session.json`.","commonSituations":"Wrapping export in a script that always saves a local copy, then adding --nostr without removing --output.","solutions":["Remove --output when sharing via --nostr (the deeplink is printed to stdout)","Run two commands if you need both: one plain export with --output, one --nostr export"],"exampleFix":"# before\ngoose session export <id> --nostr --output out.json\n# after\ngoose session export <id> --nostr                          # prints share link\ngoose session export <id> --format json --output out.json   # local copy","handlingStrategy":"validation","validationCode":"if nostr && output_path.is_some() {\n    anyhow::bail!(\"--nostr cannot be combined with --output\");\n}\nhandle_session_export(id, output_path, format, nostr, relays).await?;","typeGuard":"fn nostr_output_valid(nostr: bool, output: Option<&Path>) -> bool {\n    !(nostr && output.is_some())\n}","tryCatchPattern":null,"preventionTips":["Model the two modes explicitly in wrappers: 'publish' (nostr, no file) vs 'save' (file, no nostr)","Run two exports when you need both a share link and a local file"],"tags":["session","nostr","argument-validation","export"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}