vectordotdev/vector · critical

registered log schema required

Error message

registered log schema required

What it means

The datadog_agent source attaches a schema Definition to every decoded log event via log.metadata_mut().set_schema_definition. The definition is resolved once at build time from cx.schema_definitions for the 'logs' port, falling back to the port-less (None) entry (datadog_agent/mod.rs:197-201). If neither is registered the Option stays None and the per-event unwrap_or_else panics with 'registered log schema required', killing the log-handling path on the first event.

Source

Thrown at src/sources/datadog_agent/logs.rs:176

                            );

                            // compute EstimatedJsonSizeOf before enrichment
                            event_bytes_received += log.estimated_json_encoded_size_of();

                            namespace.insert_standard_vector_source_metadata(
                                log,
                                DatadogAgentConfig::NAME,
                                now,
                            );

                            if let Some(k) = &api_key {
                                log.metadata_mut().set_datadog_api_key(Arc::clone(k));
                            }

                            let logs_schema_definition = source
                                .logs_schema_definition
                                .as_ref()
                                .unwrap_or_else(|| panic!("registered log schema required"));

                            log.metadata_mut()
                                .set_schema_definition(logs_schema_definition);
                        }

                        decoded.push(event);
                    }
                }
                Ok(None) => break,
                Err(error) => {
                    // Error is logged by `vector_lib::codecs::Decoder`, no further
                    // handling is needed here.
                    if !error.can_continue() {
                        break;
                    }
                }
            }
        }

View on GitHub (pinned to 3708c39b12)

Solutions

  1. If embedding, insert the logs-port Definition (or a None default) into cx.schema_definitions before calling SourceConfig::build
  2. On stock Vector, upgrade - normal wiring always registers the definition, so hitting this is a bug
  3. Run `vector validate`, which exercises the same schema plumbing before runtime
  4. Report with the config if it reproduces on a released binary

Example fix

// before (embedding): panics on the first log event
let source = DatadogAgentConfig::default().build(cx).await?; // cx.schema_definitions is empty

// after: register definitions first
let mut cx = cx;
cx.schema_definitions.insert(Some("logs".to_string()), logs_definition);
cx.schema_definitions.insert(None, default_definition);
let source = DatadogAgentConfig::default().build(cx).await?;
Defensive patterns

Strategy: validation

Validate before calling

let has_definition = cx.schema_definitions.get(&Some("logs".to_string()))
    .or_else(|| cx.schema_definitions.get(&None))
    .is_some();
if !has_definition {
    return Err("datadog_agent requires a registered log schema definition".into());
}

Prevention

When it happens

Trigger: Building the datadog_agent source with a SourceContext whose schema_definitions map has no Some("logs") entry and no None entry, then receiving a log event - typically only when the source is embedded or tested outside the normal config-to-topology wiring that registers per-port definitions.

Common situations: Custom harnesses or third-party embeddings that construct SourceContext by hand; version transitions where per-port schema definitions became mandatory for multi-output sources (logs/metrics/traces); tests that build the source without the full topology builder.

Related errors


AI-assisted analysis of vectordotdev/vector@3708c39b12 (2026-08-20). Data as JSON: /api/errors/371cdaae19da5f27. Report an issue: GitHub.