vectordotdev/vector · error
Source example has no sources section
Error message
Source example has no sources section
What it means
Vector's `vdev check component-examples` wraps each component example config to build a validation topology. `wrap_source` expects the example YAML for a source component to have a top-level `sources` section; if that key is absent it cannot identify the source key or wire up validation sinks, so it throws this error.
Solutions
- Add a top-level `sources:` mapping containing the component key to the example YAML.
- Verify the example file is registered/selected as a source example, not a transform or sink example.
- Confirm YAML indentation places `sources:` at the document root, not nested under another key.
Example fix
// before (example YAML)
template: my_source
log:
namespace: x
// after
sources:
my_source:
type: my_source
log:
namespace: x Defensive patterns
Strategy: validation
Validate before calling
const root = yaml.parse(exampleYaml);
if (typeof root !== 'object' || root === null || Array.isArray(root) || !('sources' in root) || typeof root.sources !== 'object' || root.sources === null) {
throw new Error('source example must have a top-level `sources` mapping');
} Type guard
function hasSourcesSection(root) {
return typeof root === 'object' && root !== null && !Array.isArray(root) && typeof root.sources === 'object' && root.sources !== null;
} Prevention
- Copy example YAML from an existing source example as a template.
- Run `vdev check component-examples` locally before pushing.
- Keep `sources:` at the document root with one string-keyed entry.
When it happens
Trigger: Running the component example check against an example file whose component YAML lacks a top-level `sources` mapping (e.g. it uses a different root key, nests the component under something else, or the file is not actually a source example).
Common situations: A new source was documented with an example YAML that follows a sink/transform template by mistake; the example was hand-edited and `sources:` was removed or renamed; a shared example file was reused for the wrong component type.
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
- has no component identifier
- Sink example has no sinks section
- Sink is missing
- Source output has no name
- Transform example has no transforms section
AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16).
Data as JSON: /api/errors/85df4582392d6feb.
Report an issue: GitHub.
Appendix: source
Thrown at vdev/src/commands/check/component_examples.rs:170
fn wrap_config(
kind: &str,
component_yaml: YamlValue,
component: &Value,
) -> Result<Option<YamlValue>> {
match kind {
"sources" => wrap_source(&component_yaml, component).map(Some),
"transforms" => wrap_transform(&component_yaml, component),
"sinks" => wrap_sink(&component_yaml, component),
_ => Ok(Some(component_yaml)),
}
}
fn wrap_source(component_yaml: &YamlValue, component: &Value) -> Result<YamlValue> {
let mut root = yaml_mapping(component_yaml, "source example")?;
let sources = yaml_mapping(
mapping_value(&root, "sources")
.ok_or_else(|| anyhow!("Source example has no sources section"))?,
"source example sources",
)?;
let source_key = mapping_key(&sources, "source example")?;
let mut sinks = Mapping::new();
let outputs = component.get("outputs").and_then(Value::as_array);
let has_named_outputs = outputs
.and_then(|outputs| outputs.first())
.and_then(|output| output.get("name"))
.and_then(Value::as_str)
.is_some_and(|name| name != "<component_id>");
if has_named_outputs {
for output in outputs.expect("Named outputs require an output list") {
let name = output
.get("name")
.and_then(Value::as_str)
.ok_or_else(|| anyhow!("Source output has no name"))?;
sinks.insert(View on GitHub (pinned to bdb87aeaa4)