{"record":{"id":"80268b298fec874b","repo":"vectordotdev/vector","slug":"sink-example-has-no-sinks-section","errorCode":null,"errorMessage":"Sink example has no sinks section","messagePattern":"Sink example has no sinks section","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vdev/src/commands/check/component_examples.rs","lineNumber":273,"sourceCode":"        (\n            YamlValue::String(\"transforms\".to_owned()),\n            YamlValue::Mapping(transforms),\n        ),\n        (\n            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        (","sourceCodeStart":255,"sourceCodeEnd":291,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/vdev/src/commands/check/component_examples.rs#L255-L291","documentation":"`wrap_sink` builds a validation topology for sink examples and requires the example YAML to have a top-level `sinks` mapping. If that key is absent, the sink key cannot be extracted and the validation source cannot be wired into the sink, so it throws this error.","triggerScenarios":"Running the component example check on an example file whose component YAML lacks a top-level `sinks` section (wrong root key, nesting, or wrong component-type example).","commonSituations":"A new sink's example was authored from a source/transform template; hand edits removed or renamed `sinks:`; the section was accidentally nested under another key due to indentation.","solutions":["Add a top-level `sinks:` mapping containing the sink key to the example YAML.","Verify the example is registered as a sink example.","Check YAML indentation so `sinks:` is at the document root."],"exampleFix":"// before\nblackhole:\n  inputs: [x]\n\n// after\nsinks:\n  blackhole:\n    type: blackhole\n    inputs: [x]","handlingStrategy":"validation","validationCode":"const root = yaml.parse(exampleYaml);\nif (!root || Array.isArray(root) || typeof root !== 'object' || typeof root.sinks !== 'object' || root.sinks === null) {\n  throw new Error('sink example must have a top-level `sinks` mapping');\n}","typeGuard":"function hasSinksSection(root) {\n  return typeof root === 'object' && root !== null && !Array.isArray(root) && typeof root.sinks === 'object' && root.sinks !== null;\n}","tryCatchPattern":null,"preventionTips":["Copy an existing sink example when adding new sink docs.","Run `vdev check component-examples` locally before pushing.","Keep `sinks:` at the document root."],"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"}