{"record":{"id":"3e837737ab3397ac","repo":"nautechsystems/nautilus_trader","slug":"pool-created-event-data-too-short-expected-at-lea","errorCode":null,"errorMessage":"Pool created event data too short: expected at least 64 bytes, was {}","messagePattern":"Pool created event data too short: expected at least 64 bytes, was (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/adapters/blockchain/src/exchanges/parsing/uniswap_v3/pool_created.rs","lineNumber":97,"sourceCode":"///\n/// # Errors\n///\n/// Returns an error if the log parsing fails or if the event data is invalid.\npub fn parse_pool_created_event_rpc(log: &RpcLog) -> anyhow::Result<PoolCreatedEvent> {\n    rpc_log::validate_event_signature(log, POOL_CREATED_EVENT_SIGNATURE_HASH, \"PoolCreatedEvent\")?;\n\n    let block_number = rpc_log::extract_block_number(log)?;\n    let token0 = rpc_log::extract_address_from_topic(log, 1, \"token0\")?;\n    let token1 = rpc_log::extract_address_from_topic(log, 2, \"token1\")?;\n\n    // Extract fee from topic3\n    let fee_bytes = rpc_log::extract_topic_bytes(log, 3)?;\n    let fee = core::extract_u32_from_bytes(&fee_bytes)?;\n\n    // Extract tick_spacing and pool from data\n    let data_bytes = rpc_log::extract_data_bytes(log)?;\n\n    anyhow::ensure!(\n        data_bytes.len() >= 64,\n        \"Pool created event data too short: expected at least 64 bytes, was {}\",\n        data_bytes.len()\n    );\n\n    let tick_spacing = u32::from_be_bytes(data_bytes[28..32].try_into()?);\n    let pool_address = Address::from_slice(&data_bytes[44..64]);\n\n    Ok(PoolCreatedEvent::new(\n        block_number,\n        token0,\n        token1,\n        pool_address,\n        PoolIdentifier::Address(Ustr::from(&pool_address.to_string())), // For V2/V3, pool_identifier = pool_address\n        Some(fee),\n        Some(tick_spacing),\n    ))\n}","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/nautechsystems/nautilus_trader/blob/18893faf8b356be3320add8de2f861b0b647cf06/crates/adapters/blockchain/src/exchanges/parsing/uniswap_v3/pool_created.rs#L79-L115","documentation":"parse_pool_created_event_rpc throws this (via anyhow::ensure!) when the RPC log's data section is shorter than 64 bytes, which is the minimum needed to read tick_spacing (bytes 28..32) and the pool address (bytes 32..64) for a Uniswap V3 PoolCreated event. The library validates data length up front to avoid panics from out-of-range slicing. A short data section means the log cannot be a well-formed PoolCreated event.","triggerScenarios":"Calling parse_pool_created_event_rpc with a log whose data field is shorter than 64 bytes — e.g. an empty data section, a fork contract that emits only fee in data, or a malformed test log.","commonSituations":"Pointing the adapter at a non-canonical factory whose event layout differs; RPC providers returning truncated data for pruned/archived requests; hand-written unit-test logs with incomplete data; mixing up V2 PairCreated (different layout) with V3 PoolCreated.","solutions":["Log the raw data hex and confirm the source contract is the canonical Uniswap V3 factory emitting a full 64-byte data section.","Filter out logs with data.len() < 64 before calling the parser, treating them as non-V3 events.","Check your RPC provider is returning complete log data (retry or use an archive node if data is truncated).","Fix test fixtures to include the full 64-byte data payload."],"exampleFix":"// before\nlet event = parse_pool_created_event_rpc(&log)?;\n// after\nif log.data.len() < 64 {\n    tracing::warn!(len = log.data.len(), \"skipping short PoolCreated data\");\n    return Ok(None);\n}\nlet event = parse_pool_created_event_rpc(&log)?;","handlingStrategy":"validation","validationCode":"if log.data.len() < 64 {\n    // skip: not a well-formed V3 PoolCreated event\n    return Ok(None);\n}","typeGuard":null,"tryCatchPattern":"match parse_pool_created_event_rpc(&log) {\n    Ok(event) => handle(event),\n    Err(e) if e.to_string().contains(\"data too short\") => {\n        tracing::warn!(\"short PoolCreated data; likely non-V3 event\");\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Check data.len() >= 64 before invoking the RPC parser.","Distinguish V3 PoolCreated from V2 PairCreated layouts before dispatch.","Use a reliable/archive RPC provider to avoid truncated log data.","Include full 64-byte data in test fixtures."],"tags":["blockchain","uniswap-v3","log-parsing","rpc"],"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-14T00:17:10.932Z"}