{"record":{"id":"0d89f6411c1bb4d9","repo":"nautechsystems/nautilus_trader","slug":"invalid-uuid-broker-client-order-id-payload-length","errorCode":null,"errorMessage":"invalid UUID broker client order ID payload length","messagePattern":"invalid UUID broker client order ID payload length","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/adapters/binance/src/common/encoder.rs","lineNumber":248,"sourceCode":"    let Some(payload) = encoded.strip_prefix(&prefix) else {\n        return Ok(encoded.to_string());\n    };\n\n    let Some((&signal, data)) = payload.as_bytes().split_first() else {\n        anyhow::bail!(\"missing broker client order ID signal\");\n    };\n\n    match signal {\n        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        ),","sourceCodeStart":230,"sourceCodeEnd":266,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/binance/src/common/encoder.rs#L230-L266","documentation":"decode_broker_id_checked requires that UUID-format broker client order ID payloads (signal SIGNAL_UUID_HYPHENS or SIGNAL_UUID_NO_HYPHENS) carry exactly UUID_B62_LEN base62 characters after the signal byte. This error indicates the body length is wrong, so the payload cannot be a valid packed UUID produced by the encoder.","triggerScenarios":"Calling decode_broker_id / decode_client_order_id with a UUID-signal payload whose data portion is not UUID_B62_LEN characters — truncated payloads, manually crafted IDs, or IDs encoded by an incompatible encoder version.","commonSituations":"Broker IDs truncated by exchange field limits or logging; hand-editing stored order IDs; mixing payloads from adapter versions with different UUID packing; passing plain UUID strings without the encoder wrapper.","solutions":["Regenerate the broker ID using the crate's UUID encoder so the payload has the exact expected length.","Confirm no upstream system (exchange, database, log pipeline) truncated or padded the stored broker ID.","Decode with the adapter version that matches the encoder that produced the payload.","If you have the original UUID, re-encode it rather than trying to repair the damaged payload."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const UUID_B62_LEN: usize = /* per crate */ 22;\nfn is_valid_uuid_payload(p: &[u8]) -> bool {\n    p.len() == 1 + UUID_B62_LEN\n        && matches!(p[0], SIGNAL_UUID_HYPHENS | SIGNAL_UUID_NO_HYPHENS)\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Round-trip test encode/decode for UUID client order IDs in CI.","Beware exchange-side ID length limits that may truncate broker IDs.","Do not rewrite or trim stored broker IDs during logging or migration."],"tags":["binance","decoding","payload-length","uuid"],"backgroundTag":"invalid-argument-format","analyzedSha":"18893faf8b356be3320add8de2f861b0b647cf06","analyzedAt":"2026-09-08T20:49:34.690Z","contentChangedAt":"2026-09-08T20:49:34.690Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}