{"record":{"id":"11c927b988f13d8a","repo":"quickwit-oss/quickwit","slug":"label-id-value-is-invalid-identifiers-must","errorCode":null,"errorMessage":"{label} ID `{value}` is invalid: identifiers must match the following regular expression: `^[a-zA-Z][a-zA-Z0-9-_\\.]{{2,254}}$`","messagePattern":"(.+?) ID `(.+?)` is invalid: identifiers must match the following regular expression: `\\^\\[a-zA-Z\\]\\[a-zA-Z0-9-_\\\\\\.\\](.+?)\\}\\$`","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-config/src/lib.rs","lineNumber":147,"sourceCode":"    SourceInputFormat,\n    SourceParams,\n    StableLogMergePolicyConfig,\n    TransformConfig,\n    VecSourceParams,\n    VersionedIndexConfig,\n    VersionedIndexTemplate,\n    VersionedSourceConfig,\n    VoidSourceParams,\n)))]\n/// Schema used for the OpenAPI generation which are apart of this crate.\npub struct ConfigApiSchemas;\n\n/// Checks whether an identifier conforms to Quickwit naming conventions.\npub fn validate_identifier(label: &str, value: &str) -> anyhow::Result<()> {\n    static IDENTIFIER_REGEX: LazyLock<Regex> = LazyLock::new(|| {\n        Regex::new(r\"^[a-zA-Z][a-zA-Z0-9-_\\.]{2,254}$\").expect(\"regular expression should compile\")\n    });\n    ensure!(\n        IDENTIFIER_REGEX.is_match(value),\n        \"{label} ID `{value}` is invalid: identifiers must match the following regular \\\n         expression: `^[a-zA-Z][a-zA-Z0-9-_\\\\.]{{2,254}}$`\"\n    );\n    Ok(())\n}\n\n/// Checks whether an index ID pattern conforms to Quickwit conventions.\n/// Index ID patterns accept the same characters as identifiers AND accept `*`\n/// chars to allow for glob-like patterns.\npub fn validate_index_id_pattern(pattern: &str, allow_negative: bool) -> anyhow::Result<()> {\n    static IDENTIFIER_REGEX_WITH_GLOB_PATTERN: LazyLock<Regex> = LazyLock::new(|| {\n        Regex::new(r\"^[a-zA-Z\\*][a-zA-Z0-9-_\\.\\*]{0,254}$\")\n            .expect(\"regular expression should compile\")\n    });\n    static IDENTIFIER_REGEX_WITH_GLOB_PATTERN_NEGATIVE: LazyLock<Regex> = LazyLock::new(|| {\n        Regex::new(r\"^-?[a-zA-Z\\*][a-zA-Z0-9-_\\.\\*]{0,254}$\")\n            .expect(\"regular expression should compile\")","sourceCodeStart":129,"sourceCodeEnd":165,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-config/src/lib.rs#L129-L165","documentation":"`validate_identifier` enforces Quickwit naming conventions for IDs (index, source, template, etc.). The value must match `^[a-zA-Z][a-zA-Z0-9-_\\.]{2,254}$`: start with a letter, then 2-254 characters of letters, digits, `-`, `_`, or `.`. Any ID violating this regex is rejected with a message containing the label and offending value.","triggerScenarios":"Creating/updating an index, source, or template whose ID starts with a digit or symbol, contains spaces/slashes/uppercase-hostile characters beyond the allowed set, or is shorter than 3 characters or longer than 255.","commonSituations":"Using a UUID or timestamp as the index id (starts with a digit); deriving an id from a filename with invalid characters; a trailing newline or whitespace sneaking into a CLI-provided source id (`add_source`, `delete_source_cli`).","solutions":["Rename the entity so the ID starts with a letter and uses only `[a-zA-Z0-9-_\\.]` with length 3-255","Strip whitespace/newlines from CLI or API-supplied IDs before calling the API","Prefix generated IDs (e.g. UUIDs) with a letter, such as `idx-<uuid>`"],"exampleFix":"// before\nlet index_id = \"2024_logs\";\n// after\nlet index_id = \"idx-2024-logs\";","handlingStrategy":"validation","validationCode":"fn is_valid_quickwit_id(value: &str) -> bool {\n    let bytes = value.as_bytes();\n    if bytes.len() < 3 || bytes.len() > 255 { return false; }\n    if !bytes[0].is_ascii_alphabetic() { return false; }\n    bytes.iter().all(|&b| b.is_ascii_alphanumeric() || b == b'-' || b == b'_' || b == b'.')\n}","typeGuard":"function isValidQuickwitId(value) {\n  return /^[a-zA-Z][a-zA-Z0-9-_.]{2,254}$/.test(value);\n}","tryCatchPattern":"match quickwit_config::validate_identifier(\"index\", &index_id) {\n    Err(e) => {\n        eprintln!(\"{e}: choose an ID starting with a letter, 3-255 chars of [a-zA-Z0-9-_.]\");\n        return Err(e);\n    }\n    Ok(()) => {}\n}","preventionTips":["Validate IDs at the edge of your tooling before any Quickwit API call","Trim whitespace from CLI/flag-provided IDs","Prefix generated identifiers (UUIDs, timestamps) with a letter, e.g. `idx-`"],"tags":["validation","naming","config"],"backgroundTag":"invalid-identifier-format","analyzedSha":"a39730c5cdcd1a4fe798403737ae293999ea21f8","analyzedAt":"2026-09-08T13:19:37.784Z","contentChangedAt":"2026-09-08T13:19:37.784Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}