vectordotdev/vector · error
global log_schema.message_key to be valid path
Error message
global log_schema.message_key to be valid path
What it means
`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.
Source
Thrown at src/sources/kubernetes_logs/transform_utils/mod.rs:10
use vector_lib::config::{LogNamespace, log_schema};
use vrl::{owned_value_path, path::OwnedTargetPath};
pub(crate) fn get_message_path(log_namespace: LogNamespace) -> OwnedTargetPath {
match log_namespace {
LogNamespace::Vector => OwnedTargetPath::event(owned_value_path!()),
LogNamespace::Legacy => OwnedTargetPath::event(
log_schema()
.message_key()
.expect("global log_schema.message_key to be valid path")
.clone(),
),
}
}
View on GitHub (pinned to 3708c39b12)
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
Example fix
# before log_schema: timestamp_key: ts # message_key missing or empty # after log_schema: message_key: message timestamp_key: ts
Defensive patterns
Strategy: validation
Validate before calling
# shell: catch a missing/blank message_key before deploy vector validate /etc/vector/vector.yaml --no-environment # and confirm the key resolves ! grep -qE '^\s*message_key:\s*$' /etc/vector/vector.yaml
Prevention
- 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
When it happens
Trigger: 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.
Common situations: 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.
Related errors
- valid message key
- valid host key
- valid metadata key
- registered log schema required
- all json-file keys should be matched
AI-assisted analysis of vectordotdev/vector@3708c39b12 (2026-08-20).
Data as JSON: /api/errors/b7bc3f7703840713.
Report an issue: GitHub.