{"record":{"id":"a83deed6b01b4519","repo":"quickwit-oss/quickwit","slug":"field-name-is-empty","errorCode":null,"errorMessage":"field name is empty","messagePattern":"field name is empty","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-doc-mapper/src/doc_mapper/field_mapping_entry.rs","lineNumber":888,"sourceCode":"/// - must be different from Quickwit's reserved field mapping names `_source`, `_dynamic`,\n///   `_field_presence`;\n/// - must not be longer than 255 characters.\npub fn validate_field_mapping_name(field_mapping_name: &str) -> anyhow::Result<()> {\n    static FIELD_MAPPING_NAME_PTN: LazyLock<Regex> =\n        LazyLock::new(|| Regex::new(FIELD_MAPPING_NAME_PATTERN).unwrap());\n\n    if QW_RESERVED_FIELD_NAMES.contains(&field_mapping_name) {\n        bail!(\n            \"field name `{field_mapping_name}` is reserved. the following fields are reserved for \\\n             Quickwit internal usage: {}\",\n            QW_RESERVED_FIELD_NAMES.join(\", \"),\n        );\n    }\n    if FIELD_MAPPING_NAME_PTN.is_match(field_mapping_name) {\n        return Ok(());\n    }\n    if field_mapping_name.is_empty() {\n        bail!(\"field name is empty\");\n    }\n    if field_mapping_name.starts_with('.') {\n        bail!(\n            \"field name `{}` must not start with a dot `.`\",\n            field_mapping_name\n        );\n    }\n    if field_mapping_name.len() > 255 {\n        bail!(\n            \"field name `{}` is too long. field names must not be longer than 255 characters\",\n            field_mapping_name\n        )\n    }\n    let first_char = field_mapping_name.chars().next().unwrap();\n    if !first_char.is_ascii_alphabetic() {\n        bail!(\n            \"field name `{}` is invalid. field names must start with an uppercase or lowercase \\\n             ASCII letter, or an underscore `_`\",","sourceCodeStart":870,"sourceCodeEnd":906,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-doc-mapper/src/doc_mapper/field_mapping_entry.rs#L870-L906","documentation":"Quickwit rejects index mapping field names that are empty strings. Field names must match FIELD_MAPPING_NAME_PTN; an empty name cannot be addressed in queries or stored in the tantivy schema, so validation fails fast when parsing a field mapping entry.","triggerScenarios":"Calling FieldMappingEntryBuilder::default() or deserializing a mapping JSON/YAML where a field's name key is present but its value is \"\" (e.g. `{\"\": {\"type\": \"text\"}}`), or building a FieldMappingEntry programmatically with name: String::new().","commonSituations":"Templated index config generation that leaves a name placeholder unfilled; YAML `\"\":` entries from scripting; JSON keys accidentally stripped by a config transformer; copying an example mapping and deleting the field name.","solutions":["Give the field a non-empty name in the index config mapping section.","Check templating/config-generation scripts that the field name placeholder is substituted.","Validate the mapping JSON before calling create index (e.g. quickwit index create will fail with this error pointing at the offending entry)."],"exampleFix":"// before\n{\"\": {\"type\": \"text\"}}\n// after\n{\"message\": {\"type\": \"text\"}}","handlingStrategy":"validation","validationCode":"fn validate_field_name(name: &str) -> Result<(), String> {\n    if name.is_empty() {\n        return Err(\"field name must not be empty\".into());\n    }\n    Ok(())\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always require an explicit field name in mapping templates.","Fail fast in config generators when a name placeholder is unsubstituted.","Validate mapping JSON/YAML with a schema before submitting create-index."],"tags":["validation","index-config","rust"],"backgroundTag":"empty-required-field","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"}