{"record":{"id":"b7bc3f7703840713","repo":"vectordotdev/vector","slug":"global-log-schema-message-key-to-be-valid-path-b7bc3f","errorCode":null,"errorMessage":"global log_schema.message_key to be valid path","messagePattern":"global log_schema\\.message_key to be valid path","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/sources/kubernetes_logs/transform_utils/mod.rs","lineNumber":10,"sourceCode":"use vector_lib::config::{LogNamespace, log_schema};\nuse vrl::{owned_value_path, path::OwnedTargetPath};\n\npub(crate) fn get_message_path(log_namespace: LogNamespace) -> OwnedTargetPath {\n    match log_namespace {\n        LogNamespace::Vector => OwnedTargetPath::event(owned_value_path!()),\n        LogNamespace::Legacy => OwnedTargetPath::event(\n            log_schema()\n                .message_key()\n                .expect(\"global log_schema.message_key to be valid path\")\n                .clone(),\n        ),\n    }\n}\n","sourceCodeStart":1,"sourceCodeEnd":15,"githubUrl":"https://github.com/vectordotdev/vector/blob/3708c39b12a93212ed8b8d7510b4cc7769cb5864/src/sources/kubernetes_logs/transform_utils/mod.rs#L1-L15","documentation":"`log_schema().message_key()` returns an Option; it is None when the global `log_schema.message_key` configuration is unset, blank, or does not parse into a valid value path. The kubernetes_logs transform utilities unconditionally `expect(\"global log_schema.message_key to be valid path\")` when computing the message target path for the Legacy log namespace, so a schema without a usable message key panics while the pipeline is being built or run.","triggerScenarios":"Running kubernetes_logs (or any Legacy-namespace component that goes through `get_message_path`) with a top-level `log_schema:` block whose `message_key` is omitted, empty, or an invalid path expression.","commonSituations":"Operators overriding `log_schema` keys in vector.yaml (e.g. renaming message to msg) and mistyping or blanking the value; YAML indentation that puts `message_key` under the wrong block so the global schema ends up without it.","solutions":["Set a valid `log_schema.message_key` (default `message`) at the top level of the config","Run `vector validate <config>` before deploying to catch schema mistakes","If embedding: propagate a configuration error instead of expect when the key is absent"],"exampleFix":"# before\nlog_schema:\n  timestamp_key: ts\n  # message_key missing or empty\n# after\nlog_schema:\n  message_key: message\n  timestamp_key: ts","handlingStrategy":"validation","validationCode":"# shell: catch a missing/blank message_key before deploy\nvector validate /etc/vector/vector.yaml --no-environment\n# and confirm the key resolves\n! grep -qE '^\\s*message_key:\\s*$' /etc/vector/vector.yaml","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always set message_key, timestamp_key, host_key together when overriding log_schema","Run `vector validate` in CI for every config change","Avoid empty-string values for log_schema keys"],"tags":["log-schema","configuration","kubernetes-logs","vrl-path","panic"],"backgroundTag":"invalid-log-schema-key","analyzedSha":"3708c39b12a93212ed8b8d7510b4cc7769cb5864","analyzedAt":"2026-08-20T07:02:18.786Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}