{"record":{"id":"fbdc2da2b0d0bb9b","repo":"vectordotdev/vector","slug":"transform-example-has-no-transforms-section","errorCode":null,"errorMessage":"Transform example has no transforms section","messagePattern":"Transform example has no transforms section","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vdev/src/commands/check/component_examples.rs","lineNumber":213,"sourceCode":"            YamlValue::String(\"_validate_sink\".to_owned()),\n            blackhole(&source_key),\n        );\n    }\n    root.insert(\n        YamlValue::String(\"sinks\".to_owned()),\n        YamlValue::Mapping(sinks),\n    );\n    Ok(YamlValue::Mapping(root))\n}\n\nfn wrap_transform(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, \"transform example\")?;\n    let transforms = yaml_mapping(\n        mapping_value(&root, \"transforms\")\n            .ok_or_else(|| anyhow!(\"Transform example has no transforms section\"))?,\n        \"transform example transforms\",\n    )?;\n    let transform_key = mapping_key(&transforms, \"transform example\")?;\n    let mut transform = yaml_mapping(\n        mapping_value(&transforms, &transform_key)\n            .ok_or_else(|| anyhow!(\"Transform {transform_key} is missing\"))?,\n        \"transform configuration\",\n    )?;\n    transform.insert(\n        YamlValue::String(\"inputs\".to_owned()),\n        yaml_list([\"_validate_source\"]),\n    );\n\n    let named_outputs = route_outputs(&transform);\n    let mut sinks = Mapping::new();\n    if named_outputs.is_empty() {\n        sinks.insert(\n            YamlValue::String(\"_validate_sink\".to_owned()),","sourceCodeStart":195,"sourceCodeEnd":231,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/vdev/src/commands/check/component_examples.rs#L195-L231","documentation":"`wrap_transform` builds a validation topology for transform examples and requires the example YAML to have a top-level `transforms` mapping. If the key is missing, the transform key cannot be extracted and inputs cannot be wired to the validation source, so it throws this error.","triggerScenarios":"Running the component example check on an example file whose component YAML lacks a top-level `transforms` section (wrong root key, nested structure, or the file is not a transform example).","commonSituations":"A new transform's example was authored from a source or sink template; manual edits moved or renamed `transforms:`; YAML indentation accidentally nested `transforms` under another key.","solutions":["Add a top-level `transforms:` mapping containing the transform key to the example YAML.","Verify the example is registered as a transform example.","Check YAML indentation so `transforms:` sits at the document root."],"exampleFix":"// before\nmy_transform:\n  type: remap\n\n// after\ntransforms:\n  my_transform:\n    type: remap","handlingStrategy":"validation","validationCode":"const root = yaml.parse(exampleYaml);\nif (!root || Array.isArray(root) || typeof root !== 'object' || typeof root.transforms !== 'object' || root.transforms === null) {\n  throw new Error('transform example must have a top-level `transforms` mapping');\n}","typeGuard":"function hasTransformsSection(root) {\n  return typeof root === 'object' && root !== null && !Array.isArray(root) && typeof root.transforms === 'object' && root.transforms !== null;\n}","tryCatchPattern":null,"preventionTips":["Use an existing transform example as the template for new transforms.","Check YAML indentation so `transforms:` is a root key.","Run the component example check in CI on every docs/config PR."],"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"}