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

While building the InfluxDB logs sink, the message key falls back to the global log_schema().message_key(). If neither the configured nor the global message key exists, the expect panics because the sink cannot locate which event field holds the log message.

Solutions

  1. Set log_schema.message_key in the Vector configuration
  2. Restore default log schema settings (message_key defaults to 'message')
  3. Return a config error instead of expect in the sink build
  4. Verify only one log_schema block is defined and it is valid

Example fix

// vector config
// before
log_schema:
  host_key: host
// after
log_schema:
  host_key: host
  message_key: message
Defensive patterns

Strategy: validation

Validate before calling

// rust: verify the message key resolves before building the sink
let key = message_key.or_else(|| log_schema().message_key().cloned())
    .ok_or_else(|| ConfigError::MissingField("log_schema.message_key"))?;

Type guard

fn has_message_key(cfg: &LogSchemaConfig) -> bool { cfg.message_key.is_some() || log_schema().message_key().is_some() }

Try / catch

let message_key = message_key.or_else(|| log_schema().message_key().cloned())
    .ok_or_else(|| anyhow!("log_schema.message_key must be a valid path"))?;

Prevention

When it happens

Trigger: Building the InfluxDB logs sink with log_schema.message_key unset/None AND the global default also unavailable (e.g. log schema globals modified so message_key() returns None).

Common situations: Custom log_schema configuration that omits message_key; programmatic startup with altered global schema defaults.

Understand the failure class

Background: "is required", "must be set", "missing required field": configuration validation errors across open-source libraries — this error's family across 36 libraries.

Related errors


AI-assisted analysis of vectordotdev/vector@bdb87aeaa4 (2026-09-16). Data as JSON: /api/errors/e1366263254dd8ec. Report an issue: GitHub.

Appendix: source

Thrown at src/sinks/influxdb/logs.rs:318

            source_type_key,
        } = validated;

        let tls_settings = TlsSettings::from_options(self.tls.as_ref())?;
        let client = HttpClient::new(tls_settings, cx.proxy())?;
        let healthcheck = self.healthcheck(client.clone())?;

        let request = self.request.into_settings();

        // Resolve the `log_schema()` fallbacks here, after the global log schema
        // has been initialized, so custom global log schema keys are honored.
        let host_key = host_key
            .clone()
            .or_else(|| log_schema().host_key().cloned())
            .expect("global log_schema.host_key to be valid path");
        let message_key = message_key
            .clone()
            .or_else(|| log_schema().message_key().cloned())
            .expect("global log_schema.message_key to be valid path");
        let source_type_key = source_type_key
            .clone()
            .or_else(|| log_schema().source_type_key().cloned())
            .expect("global log_schema.source_type_key to be valid path");

        let sink = InfluxDbLogsSink {
            uri: uri.clone(),
            token: token.inner().to_owned(),
            protocol_version: *protocol_version,
            measurement: measurement.clone(),
            tags: tags.clone(),
            transformer: self.encoding.clone(),
            host_key,
            message_key,
            source_type_key,
        };

        let sink = BatchedHttpSink::new(

View on GitHub (pinned to bdb87aeaa4)