{"record":{"id":"300c34855275732d","repo":"nautechsystems/nautilus_trader","slug":"missing-raw-broker-client-order-id-payload","errorCode":null,"errorMessage":"missing raw broker client order ID payload","messagePattern":"missing raw broker client order ID payload","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/common/encoder.rs","lineNumber":257,"sourceCode":"        SIGNAL_O_HYPHENS | SIGNAL_O_NO_HYPHENS => {\n            anyhow::ensure!(\n                data.len() == O_FORMAT_B62_LEN,\n                \"invalid O-format broker client order ID payload length\"\n            );\n            let packed = decode_base62(data).context(\"invalid O-format broker client order ID\")?;\n            Ok(unpack_o_format(packed, signal == SIGNAL_O_HYPHENS))\n        }\n        SIGNAL_UUID_HYPHENS | SIGNAL_UUID_NO_HYPHENS => {\n            anyhow::ensure!(\n                data.len() == UUID_B62_LEN,\n                \"invalid UUID broker client order ID payload length\"\n            );\n            let value = decode_base62(data).context(\"invalid UUID broker client order ID\")?;\n            Ok(format_uuid(value, signal == SIGNAL_UUID_HYPHENS))\n        }\n        SIGNAL_RAW => {\n            let raw = std::str::from_utf8(data).context(\"invalid raw broker client order ID\")?;\n            anyhow::ensure!(\n                !raw.is_empty(),\n                \"missing raw broker client order ID payload\"\n            );\n            Ok(raw.to_string())\n        }\n        _ => anyhow::bail!(\n            \"unknown broker client order ID signal byte '{}'\",\n            signal as char\n        ),\n    }\n}\n\nfn build_encoded(prefix: &str, signal: u8, b62: &[u8]) -> String {\n    let mut result = String::with_capacity(prefix.len() + 1 + b62.len());\n    result.push_str(prefix);\n    result.push(signal as char);\n    // base62 output is always valid ASCII\n    result.push_str(std::str::from_utf8(b62).expect(\"base62 is valid UTF-8\"));","sourceCodeStart":239,"sourceCodeEnd":275,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/a4b06ed870971b5671d12754ea138a3ab99b1dec/crates/adapters/binance/src/common/encoder.rs#L239-L275","documentation":"Decoding a broker-prefixed client order ID whose signal byte marks a raw (unpacked) payload: everything after the signal byte should be the verbatim ClientOrderId, but the payload is empty, leaving nothing to reconstruct.","triggerScenarios":"A clientOrderId consisting exactly of broker prefix + raw-signal character with no following bytes - typically a truncated ID or a foreign ID that collides with a short broker prefix.","commonSituations":"Short/generic broker_id values colliding with exchange-generated IDs; IDs cut down to the length limit; malformed test fixtures.","solutions":["Use a longer, distinctive BinanceBrokerId","Regenerate the order IDs with the current adapter encoder rather than reconstructing them by hand","Validate stored/captured IDs for length before decoding"],"exampleFix":"# before\nbroker_id = \"B\"            # prefix+signal collisions trivial\n\n# after\nbroker_id = \"NAUTILUS7F\"   # distinctive, collisions virtually impossible","handlingStrategy":"validation","validationCode":"fn raw_payload_present(id: &str, prefix: &str) -> bool {\n    id.strip_prefix(prefix).is_none_or(|p| p.len() >= 2) // signal + payload\n}","typeGuard":"fn broker_id_decodable(id: &str, prefix: &str) -> bool {\n    id.strip_prefix(prefix).is_none_or(|p| !p.is_empty() && p.len() > 1)\n}","tryCatchPattern":"let decoded = decode_broker_id_checked(encoded, broker_id)\n    .unwrap_or_else(|e| {\n        log::warn!(\"raw payload missing for '{encoded}': {e}\");\n        encoded.to_string()\n    });","preventionTips":["Choose broker_id values unlikely to appear in any external ID","Validate stored IDs (length > prefix + 1) before batch-decoding","Monitor for decode failures as an early signal of ID collisions"],"tags":["binance","order-ids","client-order-id","encoding","decode"],"backgroundTag":"identifier-decode-failed","analyzedSha":"a4b06ed870971b5671d12754ea138a3ab99b1dec","analyzedAt":"2026-08-16T22:54:50.089Z","schemaVersion":2},"datasetVersion":"2026-08-16T23:17:17.608Z"}