vectordotdev/vector · error

Sink is missing

Error message

Sink {sink_key} is missing

What it means

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.

Solutions

  1. Ensure `sinks` contains an entry for the sink key with a complete sink configuration mapping as its value.
  2. Remove empty placeholder `sinks:` sections.
  3. Validate the example YAML with a linter to catch keys that produce null values.

Example fix

// before
sinks:
  my_sink:

// after
sinks:
  my_sink:
    type: blackhole
    inputs: ["_validate_source"]
Defensive patterns

Strategy: validation

Validate before calling

const s = root.sinks;
const entries = Object.entries(s ?? {}).filter(([, v]) => v !== null && typeof v === 'object');
if (entries.length < 1) {
  throw new Error('sinks must contain a component key with a full sink configuration');
}

Type guard

function hasSinkEntry(sinks) {
  return Object.values(sinks ?? {}).some(v => v !== null && typeof v === 'object');
}

Prevention

When it happens

Trigger: The `sinks:` section exists but is empty, or `sinks.<sink_key>` resolves to null/absent (scalar value, null value, or key mismatch).

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

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/ed72855e5c6bcf14. Report an issue: GitHub.

Appendix: source

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

            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([
        (
            YamlValue::String("sources".to_owned()),
            YamlValue::Mapping(sources),
        ),
        (
            YamlValue::String("sinks".to_owned()),

View on GitHub (pinned to bdb87aeaa4)