{"record":{"id":"826fe683ddac26c0","repo":"vectordotdev/vector","slug":"unknown-output","errorCode":null,"errorMessage":"unknown output","messagePattern":"unknown output","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/vector-core/src/source_sender/sender.rs","lineNumber":291,"sourceCode":"        E: Into<Event> + ByteSizeOf,\n        I: IntoIterator<Item = E>,\n        <I as IntoIterator>::IntoIter: ExactSizeIterator,\n    {\n        self.default_output_mut().send_batch(events).await\n    }\n\n    /// Send a batch of events event to a named output.\n    ///\n    /// This internally handles emitting [EventsSent] and [ComponentEventsDropped] events.\n    pub async fn send_batch_named<I, E>(&mut self, name: &str, events: I) -> Result<(), SendError>\n    where\n        E: Into<Event> + ByteSizeOf,\n        I: IntoIterator<Item = E>,\n        <I as IntoIterator>::IntoIter: ExactSizeIterator,\n    {\n        self.named_outputs\n            .get_mut(name)\n            .expect(\"unknown output\")\n            .send_batch(events)\n            .await\n    }\n}\n","sourceCodeStart":273,"sourceCodeEnd":296,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/lib/vector-core/src/source_sender/sender.rs#L273-L296","documentation":"`send_batch_named` looks up the requested output name in `self.named_outputs` and panics with \"unknown output\" via `.expect()` when the name is not registered. Named outputs must first be created with `add_output`; the library treats sending to an unregistered name as a programming error rather than a recoverable condition.","triggerScenarios":"Calling `sender.send_batch_named(name, events)` with a name that was never passed to `add_output` on that same `SourceSender` instance — typically a typo, a renamed output, or sending on a different sender than the one configured.","commonSituations":"Custom sources that declare named outputs in one place but send under a slightly different name; refactors renaming outputs without updating send calls; configs referencing output names the source never registers (e.g. removed or conditionally-added outputs).","solutions":["Call `add_output(name, output)` (or register the output in the source's `Output` definition) before sending to that name.","Verify the name string in `send_batch_named` exactly matches the registered output name — check for typos and casing.","Confirm you are using the same `SourceSender` instance that had the output registered.","If the name is dynamic, validate it against the registered output set before sending instead of letting it panic."],"exampleFix":"// before\nsender.send_batch_named(\"outb\", events).await?; // panics if not added\n// after\nlet recv = sender.add_output(\"outb\", Output::default());\nsender.send_batch_named(\"outb\", events).await?;","handlingStrategy":"validation","validationCode":"// Check the name is registered before sending (at source setup time)\nlet registered: Vec<&str> = vec![\"stdout\", \"errors\"]; // names passed to add_output\nassert!(registered.contains(&\"stdout\"), \"output 'stdout' not registered via add_output\");","typeGuard":"fn output_exists(sender: &SourceSender, name: &str) -> bool {\n    // if named_outputs is private, mirror registration in your own registry:\n    registered_outputs().iter().any(|n| n == name)\n}","tryCatchPattern":"// Panics are not catchable normally; validate instead, or isolate:\nlet ok = std::panic::catch_unwind(std::panic::AssertUnwindSafe(|| {\n    futures::executor::block_on(sender.send_batch_named(name, events))\n}));\nif ok.is_err() { /* unknown output name: fix registration */ }","preventionTips":["Define output names as constants shared between add_output and send_batch_named call sites.","Register every named output during source build() before any send can occur.","Never build output name strings dynamically from config without validating against the registered set.","Rename outputs with compiler-checked constants, not raw string literals."],"tags":["rust","topology","source","named-outputs"],"backgroundTag":"entity-not-found","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}