vectordotdev/vector · error

Sink example has no sinks section

Error message

Sink example has no sinks section

What it means

`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.

Solutions

  1. Add a top-level `sinks:` mapping containing the sink key to the example YAML.
  2. Verify the example is registered as a sink example.
  3. Check YAML indentation so `sinks:` is at the document root.

Example fix

// before
blackhole:
  inputs: [x]

// after
sinks:
  blackhole:
    type: blackhole
    inputs: [x]
Defensive patterns

Strategy: validation

Validate before calling

const root = yaml.parse(exampleYaml);
if (!root || Array.isArray(root) || typeof root !== 'object' || typeof root.sinks !== 'object' || root.sinks === null) {
  throw new Error('sink example must have a top-level `sinks` mapping');
}

Type guard

function hasSinksSection(root) {
  return typeof root === 'object' && root !== null && !Array.isArray(root) && typeof root.sinks === 'object' && root.sinks !== null;
}

Prevention

When it happens

Trigger: 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).

Common situations: 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.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16). Data as JSON: /api/errors/80268b298fec874b. Report an issue: GitHub.

Appendix: source

Thrown at vdev/src/commands/check/component_examples.rs:273

        (
            YamlValue::String("transforms".to_owned()),
            YamlValue::Mapping(transforms),
        ),
        (
            YamlValue::String("sinks".to_owned()),
            YamlValue::Mapping(sinks),
        ),
    ]))))
}

fn wrap_sink(component_yaml: &YamlValue, component: &Value) -> Result<Option<YamlValue>> {
    let Some(source) = validation_source(component) else {
        return Ok(None);
    };
    let root = yaml_mapping(component_yaml, "sink example")?;
    let sinks = yaml_mapping(
        mapping_value(&root, "sinks")
            .ok_or_else(|| anyhow!("Sink example has no sinks section"))?,
        "sink example sinks",
    )?;
    let sink_key = mapping_key(&sinks, "sink example")?;
    let mut sink = yaml_mapping(
        mapping_value(&sinks, &sink_key).ok_or_else(|| anyhow!("Sink {sink_key} is missing"))?,
        "sink configuration",
    )?;
    sink.insert(
        YamlValue::String("inputs".to_owned()),
        yaml_list(["_validate_source"]),
    );

    let mut sources = Mapping::new();
    sources.insert(YamlValue::String("_validate_source".to_owned()), source);
    let mut sinks = Mapping::new();
    sinks.insert(YamlValue::String(sink_key), YamlValue::Mapping(sink));
    Ok(Some(YamlValue::Mapping(Mapping::from_iter([
        (

View on GitHub (pinned to bdb87aeaa4)