{"record":{"id":"69da227823fe9d00","repo":"astrid-runtime/astrid","slug":"specify-the-topic-exactly-once-positional-or-to","errorCode":null,"errorMessage":"specify the topic exactly once (positional OR --topic, not both)","messagePattern":"specify the topic exactly once \\(positional OR --topic, not both\\)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/astrid-emit/src/lib.rs","lineNumber":147,"sourceCode":"    ///\n    /// `clap`'s `conflicts_with` already rejects supplying both, so the\n    /// only failure this surfaces is supplying neither.\n    ///\n    /// # Errors\n    ///\n    /// Returns an error if no topic was supplied (neither positional\n    /// nor `--topic`).\n    pub fn resolve_topic(self) -> Result<String> {\n        match (self.topic_positional, self.topic_flag) {\n            (Some(t), None) | (None, Some(t)) => Ok(t),\n            (None, None) => {\n                anyhow::bail!(\"a topic is required (positional `<topic>` or `--topic <topic>`)\")\n            },\n            // Unreachable in practice: clap's `conflicts_with` rejects\n            // both-supplied before we get here. Kept exhaustive so the\n            // match doesn't rely on that invariant silently.\n            (Some(_), Some(_)) => {\n                anyhow::bail!(\"specify the topic exactly once (positional OR --topic, not both)\")\n            },\n        }\n    }\n}\n\n/// Outcome of an [`emit`] call: what to print to stderr (if anything)\n/// and which process exit code to return. The fixed `{\"continue\":true}`\n/// stdout line is the caller's responsibility and is emitted\n/// unconditionally regardless of this outcome.\n#[derive(Debug)]\n#[must_use]\npub struct Outcome {\n    /// One-line diagnostic to write to stderr, or `None` on success.\n    pub stderr: Option<String>,\n    /// Process exit code — `0` on a successful publish, `1` otherwise.\n    /// **Never** `2`.\n    pub exit: ExitCode,\n}","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/astrid-runtime/astrid/blob/affd8760f44190dbdfbec23403f4c4b642c33112/crates/astrid-emit/src/lib.rs#L129-L165","documentation":"Defensive arm of resolve_topic: this is only reachable if both positional and --topic were supplied simultaneously, which clap's conflicts_with should already reject; it exists so the match is total if the parser config ever changes.","triggerScenarios":"Thrown at crates/astrid-emit/src/lib.rs:147 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Supply the topic exactly once — either positional or via --topic","Check for a duplicate flag injected by a wrapper script or alias","If seen without duplicates, report a clap conflicts_with regression"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"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"}