{"record":{"id":"ee9aef538c32cd7e","repo":"vectordotdev/vector","slug":"transform-transform-key-is-missing","errorCode":null,"errorMessage":"Transform {transform_key} is missing","messagePattern":"Transform (.+?) is missing","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"vdev/src/commands/check/component_examples.rs","lineNumber":219,"sourceCode":"        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()),\n            blackhole(&transform_key),\n        );\n    } else {\n        for output in named_outputs {\n            sinks.insert(\n                YamlValue::String(format!(\"_validate_sink_{output}\")),","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/vdev/src/commands/check/component_examples.rs#L201-L237","documentation":"After finding the `transforms` mapping, `wrap_transform` looks up the single component key inside it. If the `transforms` mapping is empty or contains no value under the extracted key (e.g. it holds a scalar or null), it reports that the named transform is missing.","triggerScenarios":"The `transforms:` section exists but is empty, or `transforms.<transform_key>` is null/a non-mapping that `mapping_value` cannot resolve to the declared key.","commonSituations":"A placeholder `transforms:` with no entries was committed; the key inside `transforms` was renamed but the check still expects the mapping-key match; YAML typo producing a null value under the key.","solutions":["Ensure the `transforms` mapping contains an entry whose key is the transform's identifier with a full config mapping as its value.","Remove empty placeholder `transforms:` sections from example files.","Confirm the transform key in the YAML matches the component name used elsewhere (e.g. for `inputs` wiring)."],"exampleFix":"// before\ntransforms: {}\n\n// after\ntransforms:\n  my_transform:\n    type: remap\n    source: \". = .\"","handlingStrategy":"validation","validationCode":"const t = root.transforms;\nconst keys = Object.keys(t ?? {});\nif (keys.length !== 1 || t[keys[0]] === null || typeof t[keys[0]] !== 'object') {\n  throw new Error('transforms must contain exactly one component key with a full config mapping');\n}","typeGuard":"function hasTransformEntry(transforms) {\n  const entries = Object.entries(transforms ?? {}).filter(([, v]) => v !== null && typeof v === 'object');\n  return entries.length >= 1;\n}","tryCatchPattern":null,"preventionTips":["Never commit empty placeholder `transforms:` sections.","Ensure the transform key inside the mapping matches the component identifier used for wiring."],"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"}