{"record":{"id":"f9c30376ffcfb26c","repo":"vectordotdev/vector","slug":"could-not-convert-concurrency-to-json","errorCode":null,"errorMessage":"Could not convert concurrency to JSON","messagePattern":"Could not convert concurrency to JSON","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"info","filePath":"src/sinks/util/service/concurrency.rs","lineNumber":164,"sourceCode":"        let mut fixed_schema = generate_number_schema::<usize>();\n        let mut fixed_metadata =\n            Metadata::with_description(\"A fixed amount of concurrency will be allowed.\");\n        fixed_metadata.set_transparent();\n        fixed_metadata.add_custom_attribute(CustomAttribute::kv(\"docs::numeric_type\", \"uint\"));\n        fixed_metadata.add_custom_attribute(CustomAttribute::kv(\"logical_name\", \"Fixed\"));\n        apply_metadata(&mut fixed_schema, fixed_metadata);\n\n        Ok(generate_one_of_schema(&[\n            none_schema,\n            adaptive_schema,\n            fixed_schema,\n        ]))\n    }\n}\n\nimpl ToValue for Concurrency {\n    fn to_value(&self) -> Value {\n        serde_json::to_value(self).expect(\"Could not convert concurrency to JSON\")\n    }\n}\n\n#[test]\nfn is_serialization_reversible() {\n    let variants = [\n        Concurrency::None,\n        Concurrency::Adaptive,\n        Concurrency::Fixed(8),\n    ];\n\n    for v in variants {\n        let value = serde_json::to_value(v).unwrap();\n        let deserialized = serde_json::from_value::<Concurrency>(value)\n            .expect(\"Failed to deserialize a previously serialized Concurrency value\");\n\n        assert_eq!(v, deserialized)\n    }","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/vectordotdev/vector/blob/bdb87aeaa4c4ff27c0ba643c1c77b21bf2ef4013/src/sinks/util/service/concurrency.rs#L146-L182","documentation":"This panic fires in `Concurrency::to_value()` when `serde_json::to_value(self)` fails. `Concurrency` serializes to a plain string enum (or number), which JSON can always represent, so serialization is infallible by construction and the expect asserts that.","triggerScenarios":"Converting a `Concurrency` value to a JSON `Value` (e.g. for config templating/health dump output); panic requires serde_json to reject a plain enum serialization, which cannot happen.","commonSituations":"Not reachable in normal operation; would only appear if the Concurrency Serialize impl were changed to emit non-JSON-representable data (e.g. maps with non-string keys).","solutions":["Report as a bug to Vector if observed after a version upgrade.","Check that any custom-patched Concurrency serialization still emits JSON-compatible values."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Keep the Concurrency enum's Serialize impl emitting plain strings/numbers.","Report occurrences after version upgrades as serialization regressions."],"tags":["rust","serde","json","panic"],"backgroundTag":"json-serialization-failed","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"}