{"record":{"id":"769912864b7b3b29","repo":"vectordotdev/vector","slug":"component-name-must-be-non-empty","errorCode":null,"errorMessage":"component name must be non-empty","messagePattern":"component name must be non-empty","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"lib/vector-config-macros/src/component_name.rs","lineNumber":155,"sourceCode":"            ),\n        ));\n    }\n\n    // Now try and parse the helper attribute as a literal string, which is the only valid form.\n    // After that, make sure it's actually valid according to our naming rules.\n    attr.parse_args::<LitStr>()\n        .map_err(|_| {\n            Error::new(\n                attr.span(),\n                format!(\n                    \"expected a string literal for the {component_type} name (i.e. `{component_type_attr}(\\\"...\\\")`)\"\n                ),\n            )\n        })\n        .and_then(|component_name| {\n            let component_name_str = component_name.value();\n            check_component_name_validity(&component_name_str)\n                .map_err(|e| Error::new(component_name.span(), e))\n                .map(|()| Some(component_name_str))\n        })\n}\n\nfn check_component_name_validity(component_name: &str) -> Result<(), String> {\n    // In a nutshell, component names must contain only lowercase ASCII alphabetic characters, or\n    // numbers, or underscores.\n\n    if component_name.is_empty() {\n        return Err(\"component name must be non-empty\".to_string());\n    }\n\n    // We only support ASCII names, so get that out of the way.\n    if !component_name.is_ascii() {\n        return Err(\"component names may only contain ASCII characters\".to_string());\n    }\n\n    // Now, we blindly try and convert the given component name into the correct format, and","sourceCodeStart":137,"sourceCodeEnd":173,"githubUrl":"https://github.com/vectordotdev/vector/blob/3708c39b12a93212ed8b8d7510b4cc7769cb5864/lib/vector-config-macros/src/component_name.rs#L137-L173","documentation":"Compile-time validation error from `check_component_name_validity` in the component-name derive. An empty string literal parses fine as `LitStr`, but the first validity check rejects the empty name because the component name becomes the schema identifier, docs slug, and config key for the component.","triggerScenarios":"Declaring a component with an empty name literal: `#[configurable_component(sink(\"\"))]` or `#[configurable_component(transform(\"\"))]`.","commonSituations":"Skeleton code generated from a template with a placeholder name, or a copy-paste where the name was deleted before the attribute was updated.","solutions":["Give the component a real name: `#[configurable_component(sink(\"my_sink\"))]`","Follow the naming rules while at it: lowercase ASCII letters, digits, underscores"],"exampleFix":"// before\n#[configurable_component(sink(\"\"))]\nstruct MySink;\n\n// after\n#[configurable_component(sink(\"my_sink\"))]\nstruct MySink;","handlingStrategy":"validation","validationCode":"# CI gate: empty names fail at compile time\ncargo check --workspace --all-targets","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never ship template/skeleton components with placeholder empty names","Fill in the name immediately when scaffolding a new component"],"tags":["rust","proc-macro","compile-time","vector","validation"],"backgroundTag":"empty-identifier","analyzedSha":"3708c39b12a93212ed8b8d7510b4cc7769cb5864","analyzedAt":"2026-08-20T07:02:18.786Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}