{"record":{"id":"d07bc7294fd4e698","repo":"quickwit-oss/quickwit","slug":"contains-an-empty-label-value","errorCode":null,"errorMessage":"{} contains an empty label value: {}","messagePattern":"(.+?) contains an empty label value: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"quickwit/quickwit-metrics/src/lib.rs","lineNumber":445,"sourceCode":"    for label in labels.split(LABELS_SEPARATOR) {\n        let (name, value) = label.split_once(KEY_VALUE_SEPARATOR).ok_or_else(|| {\n            anyhow::anyhow!(\n                \"{} contains invalid label format: {}\",\n                QW_METRICS_LABELS_ENV_VAR,\n                label\n            )\n        })?;\n        let name = name.trim();\n        if name.is_empty() {\n            anyhow::bail!(\n                \"{} contains an empty label name: {}\",\n                QW_METRICS_LABELS_ENV_VAR,\n                label\n            );\n        }\n        let value = value.trim();\n        if value.is_empty() {\n            anyhow::bail!(\n                \"{} contains an empty label value: {}\",\n                QW_METRICS_LABELS_ENV_VAR,\n                label\n            );\n        }\n        let label = Label::new(name.to_string(), value.to_string());\n        parsed_labels.push(label);\n    }\n\n    Ok(parsed_labels)\n}\n\n#[cfg(test)]\nmod tests {\n    use super::*;\n\n    #[test]\n    fn test_parse_metrics_labels() {","sourceCodeStart":427,"sourceCodeEnd":463,"githubUrl":"https://github.com/quickwit-oss/quickwit/blob/a39730c5cdcd1a4fe798403737ae293999ea21f8/quickwit/quickwit-metrics/src/lib.rs#L427-L463","documentation":"parse_metrics_labels rejects any 'name=value' label in QW_METRICS_LABELS_ENV_VAR whose value (after '=') is empty or whitespace-only after trimming, since an empty label value is meaningless for metrics.","triggerScenarios":"Setting QW_METRICS_LABELS_ENV_VAR to entries like \"cluster=\" or \"team= ,a=b\" where a value is missing after the '='.","commonSituations":"Variable interpolation producing an empty value, e.g. QW_METRICS_LABELS_ENV_VAR=\"cluster=${CLUSTER}\" with CLUSTER unset; partial manual edits.","solutions":["Provide a non-empty value for each label: \"cluster=prod\" instead of \"cluster=\"","Ensure interpolated shell variables are set before export, or hardcode the value","Drop labels you don't intend to set instead of leaving them empty"],"exampleFix":"// before\nexport QW_METRICS_LABELS_ENV_VAR=\"cluster=\"\n// after\nexport QW_METRICS_LABELS_ENV_VAR=\"cluster=prod\"","handlingStrategy":"validation","validationCode":"fn all_values_present(s: &str) -> bool {\n    s.split(',').filter(|l| !l.is_empty()).all(|l| {\n        l.split_once('=').map(|(_, v)| !v.trim().is_empty()).unwrap_or(false)\n    })\n}","typeGuard":null,"tryCatchPattern":"match parse_metrics_labels(&raw) {\n    Err(e) if e.to_string().contains(\"empty label value\") => {\n        eprintln!(\"missing value in QW_METRICS_LABELS_ENV_VAR: {e}\");\n    }\n    other => other?,\n}","preventionTips":["Verify shell variables used in interpolation are non-empty before export","Drop labels whose values are unknown instead of leaving them blank","Validate the full env var string at config-load time"],"tags":["metrics","env-var","config","validation"],"backgroundTag":"invalid-config-value","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"}