{"record":{"id":"ed72855e5c6bcf14","repo":"vectordotdev/vector","slug":"sink-sink-key-is-missing","errorCode":null,"errorMessage":"Sink {sink_key} is missing","messagePattern":"Sink (.+?) is missing","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vdev/src/commands/check/component_examples.rs","lineNumber":278,"sourceCode":"            YamlValue::String(\"sinks\".to_owned()),\n            YamlValue::Mapping(sinks),\n        ),\n    ]))))\n}\n\nfn wrap_sink(component_yaml: &YamlValue, component: &Value) -> Result<Option<YamlValue>> {\n    let Some(source) = validation_source(component) else {\n        return Ok(None);\n    };\n    let root = yaml_mapping(component_yaml, \"sink example\")?;\n    let sinks = yaml_mapping(\n        mapping_value(&root, \"sinks\")\n            .ok_or_else(|| anyhow!(\"Sink example has no sinks section\"))?,\n        \"sink example sinks\",\n    )?;\n    let sink_key = mapping_key(&sinks, \"sink example\")?;\n    let mut sink = yaml_mapping(\n        mapping_value(&sinks, &sink_key).ok_or_else(|| anyhow!(\"Sink {sink_key} is missing\"))?,\n        \"sink configuration\",\n    )?;\n    sink.insert(\n        YamlValue::String(\"inputs\".to_owned()),\n        yaml_list([\"_validate_source\"]),\n    );\n\n    let mut sources = Mapping::new();\n    sources.insert(YamlValue::String(\"_validate_source\".to_owned()), source);\n    let mut sinks = Mapping::new();\n    sinks.insert(YamlValue::String(sink_key), YamlValue::Mapping(sink));\n    Ok(Some(YamlValue::Mapping(Mapping::from_iter([\n        (\n            YamlValue::String(\"sources\".to_owned()),\n            YamlValue::Mapping(sources),\n        ),\n        (\n            YamlValue::String(\"sinks\".to_owned()),","sourceCodeStart":260,"sourceCodeEnd":296,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/vdev/src/commands/check/component_examples.rs#L260-L296","documentation":"Lookup failure in wrap_sink: after wrapping a sink example component for validation, the code fetches the single key from the 'sinks' mapping of the parsed YAML example. This bail fires when the mapping_key helper cannot produce that key — i.e. the sinks section of the example is empty or malformed, so the sink entry {sink_key} the validator expected is absent.","triggerScenarios":"The `sinks:` section exists but is empty, or `sinks.<sink_key>` resolves to null/absent (scalar value, null value, or key mismatch).","commonSituations":"An empty placeholder `sinks:` mapping was committed; the sink key was renamed in one place but not the other; YAML formatting turned the sink's value into null (e.g. `sinks:\\n  my_sink:` with nothing under it).","solutions":["Ensure `sinks` contains an entry for the sink key with a complete sink configuration mapping as its value.","Remove empty placeholder `sinks:` sections.","Validate the example YAML with a linter to catch keys that produce null values."],"exampleFix":"// before\nsinks:\n  my_sink:\n\n// after\nsinks:\n  my_sink:\n    type: blackhole\n    inputs: [\"_validate_source\"]","handlingStrategy":"validation","validationCode":"const s = root.sinks;\nconst entries = Object.entries(s ?? {}).filter(([, v]) => v !== null && typeof v === 'object');\nif (entries.length < 1) {\n  throw new Error('sinks must contain a component key with a full sink configuration');\n}","typeGuard":"function hasSinkEntry(sinks) {\n  return Object.values(sinks ?? {}).some(v => v !== null && typeof v === 'object');\n}","tryCatchPattern":null,"preventionTips":["Avoid empty `sinks:` placeholder values that YAML parses as null.","Validate example YAML with a linter before committing."],"tags":["yaml","config-validation","vector"],"backgroundTag":"missing-required-config-field","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"}