{"record":{"id":"21eccdab06da87cf","repo":"nautechsystems/nautilus_trader","slug":"unknown-payload-kind-value","errorCode":null,"errorMessage":"Unknown payload kind '{value}'","messagePattern":"Unknown payload kind '(.+?)'","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/infrastructure/src/redis/msgbus.rs","lineNumber":853,"sourceCode":"                );\n            }\n            b\"type\" => {\n                let redis::Value::BulkString(bytes) = &pair[1] else {\n                    anyhow::bail!(\"Invalid type format: {stream_msg:?}\");\n                };\n                type_name = Some(\n                    String::from_utf8(bytes.clone())\n                        .map_err(|e| anyhow::anyhow!(\"Error parsing type: {e}\"))?,\n                );\n            }\n            key if key == PAYLOAD_KIND_FIELD.as_bytes() => {\n                let redis::Value::BulkString(bytes) = &pair[1] else {\n                    anyhow::bail!(\"Invalid payload kind format: {stream_msg:?}\");\n                };\n                let value = std::str::from_utf8(bytes)\n                    .map_err(|e| anyhow::anyhow!(\"Error parsing payload kind: {e}\"))?;\n                anyhow::ensure!(\n                    value == PAYLOAD_KIND_TYPED,\n                    \"Unknown payload kind '{value}'\"\n                );\n                typed_payload = true;\n            }\n            b\"encoding\" => {\n                let redis::Value::BulkString(bytes) = &pair[1] else {\n                    anyhow::bail!(\"Invalid encoding format: {stream_msg:?}\");\n                };\n                let value = std::str::from_utf8(bytes)\n                    .map_err(|e| anyhow::anyhow!(\"Error parsing encoding: {e}\"))?;\n                encoding = value\n                    .parse()\n                    .map_err(|e| anyhow::anyhow!(\"Error parsing encoding: {e}\"))?;\n            }\n            b\"payload\" => {\n                let redis::Value::BulkString(bytes) = &pair[1] else {\n                    anyhow::bail!(\"Invalid payload format: {stream_msg:?}\");\n                };","sourceCodeStart":835,"sourceCodeEnd":871,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/infrastructure/src/redis/msgbus.rs#L835-L871","documentation":"The stream entry declares a payload-kind header, but its value is not the recognized typed constant (PAYLOAD_KIND_TYPED). The decoder uses anyhow::ensure! to reject any other kind string, since the wire protocol only defines that one value.","triggerScenarios":"decode_bus_message reads an entry whose payload-kind field contains any string other than the expected PAYLOAD_KIND_TYPED — e.g. a typo, a future/newer producer using a new kind value that this consumer version does not know, or a manually written kind.","commonSituations":"Producer and consumer version mismatch (new kind introduced upstream, old consumer); typos in hand-crafted test entries; another application reusing the stream with its own kind vocabulary.","solutions":["Align producer and consumer versions so both agree on the supported payload kind value.","Fix the published entry to use the exact expected kind constant, or omit the kind header for untyped payloads.","Check for typos or case differences in the kind value in the stream entry.","Upgrade the consumer library if the producer intentionally uses a newer kind this version cannot parse."],"exampleFix":"// before\nXADD bus * topic \"q\" kind \"typd\"\n// after (exact constant)\nXADD bus * topic \"q\" kind \"typed\"","handlingStrategy":"validation","validationCode":"// Only publish the exact supported kind constant (or omit kind entirely)\nconst PAYLOAD_KIND_TYPED: &str = \"typed\";\nassert!(kind == PAYLOAD_KIND_TYPED || kind.is_empty(), \"unsupported payload kind: {kind}\");","typeGuard":"fn known_kind(v: &str, expected: &str) -> bool { v == expected }","tryCatchPattern":"match stream_messages(&mut con, stream, count).await {\n    Ok(msgs) => { /* use msgs */ }\n    Err(e) if e.to_string().starts_with(\"Unknown payload kind\") => {\n        // upgrade consumer or reject producer version\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Use the library constant (not a hand-typed string) for the kind header.","Align producer/consumer versions before introducing new kind values.","Reject unknown kind values at publish time in your own producer wrapper."],"tags":["redis","decoding","invalid-enum","typed-payload"],"backgroundTag":"invalid-enum-value","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}