{"record":{"id":"584ed9bab9c41a60","repo":"vectordotdev/vector","slug":"valid-message-key-584ed9","errorCode":null,"errorMessage":"valid message key","messagePattern":"valid message key","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"lib/vector-core/src/config/log_schema.rs","lineNumber":130,"sourceCode":"\n    pub fn message_key(&self) -> Option<&OwnedValuePath> {\n        self.message_key.path.as_ref().map(|key| &key.path)\n    }\n\n    /// Returns an `OwnedTargetPath` of the message key.\n    /// This parses the path and will panic if it is invalid.\n    ///\n    /// This should only be used where the result will either be cached,\n    /// or performance isn't critical, since this requires memory allocation.\n    ///\n    /// # Panics\n    ///\n    /// Panics if the path in `self.message_key` is invalid.\n    pub fn owned_message_path(&self) -> OwnedTargetPath {\n        self.message_key\n            .path\n            .as_ref()\n            .expect(\"valid message key\")\n            .clone()\n    }\n\n    pub fn timestamp_key(&self) -> Option<&OwnedValuePath> {\n        self.timestamp_key.as_ref().map(|key| &key.path)\n    }\n\n    pub fn host_key(&self) -> Option<&OwnedValuePath> {\n        self.host_key.as_ref().map(|key| &key.path)\n    }\n\n    pub fn source_type_key(&self) -> Option<&OwnedValuePath> {\n        self.source_type_key.as_ref().map(|key| &key.path)\n    }\n\n    pub fn metadata_key(&self) -> Option<&OwnedValuePath> {\n        self.metadata_key.as_ref().map(|key| &key.path)\n    }","sourceCodeStart":112,"sourceCodeEnd":148,"githubUrl":"https://github.com/vectordotdev/vector/blob/3708c39b12a93212ed8b8d7510b4cc7769cb5864/lib/vector-core/src/config/log_schema.rs#L112-L148","documentation":"LogSchema::owned_message_path() (lib/vector-core/src/config/log_schema.rs) unwraps the configured message_key path with expect(\"valid message key\"). message_key is an OptionalTargetPath; when the user sets log_schema.message_key to something that parses to no path (an empty string \"\" in vector.yaml/toml), path becomes None and every component that caches the message path (sources inserting the raw log line, remap, etc.) panics on startup or first use.","triggerScenarios":"Setting log_schema: message_key: \"\" (or a value that parses to an empty path) in the config, then running Vector: components calling log_schema().owned_message_path() panic immediately. A default config never hits it because the default key is the non-empty \"message\".","commonSituations":"Users who deliberately blank out the message key trying to 'disable' the message field; config-generation tooling that emits an empty message_key value; copying a log_schema block from another config where the key was commented or emptied.","solutions":["Set log_schema.message_key to a real field name, e.g. message_key: \"message\" (or any non-empty path like \".a.b\")","Remove the log_schema block entirely to fall back to the default \"message\" key","If the intent was to stop Vector from setting a message field, check for duplicate/empty keys in the generated config rather than blanking the value"],"exampleFix":"# before (vector.yaml)\nlog_schema:\n  message_key: \"\"\n\n# after\nlog_schema:\n  message_key: \"message\"","handlingStrategy":"validation","validationCode":"// Before startup, validate the schema override parses to a real path\nlet schema: LogSchema = config.log_schema.clone().unwrap_or_default();\nif let Some(override_key) = &config.log_schema {\n    assert!(override_key.message_key().is_some(),\n        \"log_schema.message_key must be a non-empty path\");\n}","typeGuard":"fn has_message_path(schema: &LogSchema) -> bool {\n    schema.message_key().is_some()\n}","tryCatchPattern":"// Config-level: fail fast with a clear message instead of letting components panic\nif config.log_schema.as_ref().is_some_and(|s| s.message_key().is_none()) {\n    return Err(ConfigError::new(\"log_schema.message_key must not be empty\"));\n}","preventionTips":["Never blank log_schema keys to 'disable' a field; omit the key or block instead","Lint generated configs for empty-string schema keys before deploy","Test startup with vector validate --no-environment <config>"],"tags":["vector","config","log-schema","panic","startup"],"backgroundTag":"invalid-config-path","analyzedSha":"3708c39b12a93212ed8b8d7510b4cc7769cb5864","analyzedAt":"2026-08-20T07:02:18.786Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T01:17:15.007Z"}