{"record":{"id":"371cdaae19da5f27","repo":"vectordotdev/vector","slug":"registered-log-schema-required","errorCode":null,"errorMessage":"registered log schema required","messagePattern":"registered log schema required","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/sources/datadog_agent/logs.rs","lineNumber":176,"sourceCode":"                            );\n\n                            // compute EstimatedJsonSizeOf before enrichment\n                            event_bytes_received += log.estimated_json_encoded_size_of();\n\n                            namespace.insert_standard_vector_source_metadata(\n                                log,\n                                DatadogAgentConfig::NAME,\n                                now,\n                            );\n\n                            if let Some(k) = &api_key {\n                                log.metadata_mut().set_datadog_api_key(Arc::clone(k));\n                            }\n\n                            let logs_schema_definition = source\n                                .logs_schema_definition\n                                .as_ref()\n                                .unwrap_or_else(|| panic!(\"registered log schema required\"));\n\n                            log.metadata_mut()\n                                .set_schema_definition(logs_schema_definition);\n                        }\n\n                        decoded.push(event);\n                    }\n                }\n                Ok(None) => break,\n                Err(error) => {\n                    // Error is logged by `vector_lib::codecs::Decoder`, no further\n                    // handling is needed here.\n                    if !error.can_continue() {\n                        break;\n                    }\n                }\n            }\n        }","sourceCodeStart":158,"sourceCodeEnd":194,"githubUrl":"https://github.com/vectordotdev/vector/blob/3708c39b12a93212ed8b8d7510b4cc7769cb5864/src/sources/datadog_agent/logs.rs#L158-L194","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["If embedding, insert the logs-port Definition (or a None default) into cx.schema_definitions before calling SourceConfig::build","On stock Vector, upgrade - normal wiring always registers the definition, so hitting this is a bug","Run `vector validate`, which exercises the same schema plumbing before runtime","Report with the config if it reproduces on a released binary"],"exampleFix":"// before (embedding): panics on the first log event\nlet source = DatadogAgentConfig::default().build(cx).await?; // cx.schema_definitions is empty\n\n// after: register definitions first\nlet mut cx = cx;\ncx.schema_definitions.insert(Some(\"logs\".to_string()), logs_definition);\ncx.schema_definitions.insert(None, default_definition);\nlet source = DatadogAgentConfig::default().build(cx).await?;","handlingStrategy":"validation","validationCode":"let has_definition = cx.schema_definitions.get(&Some(\"logs\".to_string()))\n    .or_else(|| cx.schema_definitions.get(&None))\n    .is_some();\nif !has_definition {\n    return Err(\"datadog_agent requires a registered log schema definition\".into());\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never build sources with a hand-made SourceContext missing per-port schema definitions","Exercise configs with `vector validate` before deploy","Pin known-good Vector versions and test upgrades in staging"],"tags":["rust","vector","datadog-agent","source","schema","panic","log-schema"],"backgroundTag":"missing-log-schema","analyzedSha":"3708c39b12a93212ed8b8d7510b4cc7769cb5864","analyzedAt":"2026-08-20T07:02:18.786Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}