{"record":{"id":"3ee0ba2368e2f7b8","repo":"vectordotdev/vector","slug":"serializer-does-not-support-json","errorCode":null,"errorMessage":"Serializer does not support JSON","messagePattern":"Serializer does not support JSON","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"lib/codecs/src/encoding/serializer.rs","lineNumber":473,"sourceCode":"    ///\n    /// # Panics\n    ///\n    /// Panics if the serializer does not support encoding to JSON. Call `Serializer::supports_json`\n    /// if you need to determine the capability to encode to JSON at runtime.\n    pub fn to_json_value(&self, event: Event) -> Result<serde_json::Value, vector_common::Error> {\n        match self {\n            Serializer::Gelf(serializer) => serializer.to_json_value(event),\n            Serializer::Json(serializer) => serializer.to_json_value(event),\n            Serializer::NativeJson(serializer) => serializer.to_json_value(event),\n            Serializer::Avro(_)\n            | Serializer::Cef(_)\n            | Serializer::Csv(_)\n            | Serializer::Logfmt(_)\n            | Serializer::Text(_)\n            | Serializer::Native(_)\n            | Serializer::Protobuf(_)\n            | Serializer::RawMessage(_) => {\n                panic!(\"Serializer does not support JSON\")\n            }\n            #[cfg(feature = \"syslog\")]\n            Serializer::Syslog(_) => {\n                panic!(\"Serializer does not support JSON\")\n            }\n            #[cfg(feature = \"opentelemetry\")]\n            Serializer::Otlp(_) => {\n                panic!(\"Serializer does not support JSON\")\n            }\n        }\n    }\n\n    /// Returns the chunking implementation for the serializer, if any is supported.\n    pub fn chunker(&self) -> Option<Chunker> {\n        match self {\n            Serializer::Gelf(gelf) => Some(Chunker::Gelf(gelf.chunker())),\n            _ => None,\n        }","sourceCodeStart":455,"sourceCodeEnd":491,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/lib/codecs/src/encoding/serializer.rs#L455-L491","documentation":"Panic from `.expect(\"all required builder params specified\")` on `DeleteMessageBatchRequestEntry::builder().build()` in the `Ok` (skip-success) arm of `run_once`. Like the other builder expects, aws-sdk-sqs `build()` returns Err only when required setters (`id`, `receipt_handle`) were omitted; here both are set, so a failure signals a broken invariant or SDK API change rather than bad input data.","triggerScenarios":"Building a delete entry without `.id()` or `.receipt_handle()` at src/sources/aws_s3/sqs.rs:524 — typically after a refactor moves the `receipt_handle` variable (it is consumed here without clone) or an aws-sdk upgrade changes required builder fields.","commonSituations":"aws-sdk-sqs crate upgrade; moving `receipt_handle` into an earlier branch so the value is no longer available; copying this block elsewhere and forgetting one setter.","solutions":["Confirm `.id(message_id)` and `.receipt_handle(receipt_handle)` are both chained immediately before `.build()`.","Check for ownership issues: `receipt_handle` is moved here; ensure no earlier code in the same arm moved it first (compiler will normally catch this).","Pin/align the aws-sdk-sqs version with vector's expected one and re-check builder required fields.","Swap the expect for graceful error handling so a bad entry skips deletion instead of crashing the source."],"exampleFix":"// before\nDeleteMessageBatchRequestEntry::builder()\n    .id(message_id)\n    .receipt_handle(receipt_handle)\n    .build()\n    .expect(\"all required builder params specified\")\n// after\nlet entry = DeleteMessageBatchRequestEntry::builder()\n    .id(message_id)\n    .receipt_handle(receipt_handle)\n    .build()\n    .unwrap_or_else(|e| panic!(\"SQS delete entry invalid: {e}\"));","handlingStrategy":"validation","validationCode":"fn build_delete_entry(id: String, receipt_handle: String) -> Option<DeleteMessageBatchRequestEntry> {\n    if id.is_empty() || receipt_handle.is_empty() { return None; }\n    DeleteMessageBatchRequestEntry::builder().id(id).receipt_handle(receipt_handle).build().ok()\n}","typeGuard":"fn has_receipt(m: &SqsMessage) -> bool { m.receipt_handle.as_deref().map_or(false, |r| !r.is_empty()) }","tryCatchPattern":"if let Ok(entry) = DeleteMessageBatchRequestEntry::builder().id(id).receipt_handle(rh).build() {\n    delete_entries.push(entry);\n} else { warn!(\"skipping invalid delete entry\"); }","preventionTips":["Watch ownership: receipt_handle is moved into the builder; clone if reused later in the same arm.","Run cargo vdev check rust after touching the SQS polling loop.","Pin and review aws-sdk-sqs changelogs for builder breaking changes."],"tags":["aws","sqs","rust","panic","builder-pattern"],"backgroundTag":"missing-required-argument","analyzedSha":"bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013","analyzedAt":"2026-09-16T02:53:35.741Z","contentChangedAt":"2026-09-16T02:53:35.741Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}