{"record":{"id":"5e798bbbd4f5ce3c","repo":"vectordotdev/vector","slug":"component-name","errorCode":null,"errorMessage":"{}","messagePattern":"\\{\\}","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/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/lib/vector-config-macros/src/component_name.rs#L137-L173","documentation":"Once the attribute's string literal is parsed, `check_component_name_validity` enforces Vector's naming rules (lowercase ASCII alphabetic characters). Any violation returns a `Result<(), String>` whose message is converted into a `syn::Error` at the string literal's span. The generic `{}` message here is that validation string propagated verbatim.","triggerScenarios":"Supplying a component name that violates the naming rules — uppercase letters, digits, hyphens, underscores, spaces, or non-ASCII characters — inside `#[component_name(\"...\")]` or a kind attribute like `#[source(\"My-Source1\")]`.","commonSituations":"Using kebab-case or snake_case out of habit; pasting a Rust type name (CamelCase) as the component name; adding version suffixes like `my_source_v2`.","solutions":["Rewrite the name using only lowercase ASCII letters (e.g. \"mysource\", \"http_sink\"-style digits are invalid — drop them)","Read the validation message at the error span; it states the specific rule broken","Check existing components in config/ for naming convention examples"],"exampleFix":"// before\n#[component_name(\"My-Source_v2\")]\nstruct MySourceConfig;\n// after\n#[component_name(\"mysource\")]\nstruct MySourceConfig;","handlingStrategy":"validation","validationCode":"fn valid_component_name(s: &str) -> bool {\n    !s.is_empty() && s.chars().all(|c| c.is_ascii_lowercase())\n}\nassert!(valid_component_name(\"mysource\"));","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use only lowercase ASCII letters in component names","Check existing component names in config/ before inventing one"],"tags":["rust","proc-macro","naming-validation"],"backgroundTag":"invalid-config-value","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"}