{"record":{"id":"16dc3f8f4850bb7c","repo":"FuelLabs/sway","slug":"log-id-is-missing","errorCode":null,"errorMessage":"log id is missing","messagePattern":"log id is missing","errorType":"console","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"forc-util/src/tx_utils.rs","lineNumber":97,"sourceCode":"        fuel_abi_types::abi::unified_program::UnifiedProgramABI::from_counterpart(program_abi)?;\n\n    // Create type lookup (id, TypeDeclaration)\n    let type_lookup = program_abi\n        .types\n        .iter()\n        .map(|decl| (decl.type_id, decl.clone()))\n        .collect::<HashMap<_, _>>();\n\n    let logged_type_lookup: HashMap<_, _> = program_abi\n        .logged_types\n        .iter()\n        .flatten()\n        .map(|logged_type| (logged_type.log_id.as_str(), logged_type.application.clone()))\n        .collect();\n\n    let type_application = logged_type_lookup\n        .get(&log_id)\n        .ok_or_else(|| anyhow::anyhow!(\"log id is missing\"))?;\n\n    let abi_decoder = ABIDecoder::default();\n    let param_type = ParamType::try_from_type_application(type_application, &type_lookup)?;\n    let decoded_str = abi_decoder.decode_as_debug_str(&param_type, log_data)?;\n    let decoded_log = DecodedLog { value: decoded_str };\n\n    Ok(decoded_log)\n}\n\n/// Build [`RevertInfo`] from VM receipts and an optional program ABI.\n/// This extracts the latest revert code from receipts (or a provided hint) and\n/// decodes panic metadata (message/value/backtrace) using the ABI metadata if available.\npub fn revert_info_from_receipts(\n    receipts: &[fuel_tx::Receipt],\n    program_abi: Option<&fuel_abi_types::abi::program::ProgramABI>,\n    revert_code_hint: Option<u64>,\n) -> Option<RevertInfo> {\n    let revert_code = receipts","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/FuelLabs/sway/blob/47e5e902faa42baf652dd6a0c88cd23390c1a614/forc-util/src/tx_utils.rs#L79-L115","documentation":"decode_fuel_vm_log_data builds a lookup from program_abi.logged_types keyed by each logged type's log_id string, then .get(&log_id) with this ok_or_else. The error means the receipt's log id has no corresponding logged_types entry in the ABI used for decoding — the ABI does not describe that log site.","triggerScenarios":"Decoding a LogData receipt with a stale or mismatched ABI: bytecode rebuilt after adding/removing log statements (shifting log ids) while decoding against the previous Forc.abi.json, or passing another package's ABI.","commonSituations":"forc run/test against a deployed contract using an old ABI file, workspaces where the wrong member's ABI is picked up, or mixing toolchain versions whose log-id assignment differs.","solutions":["Rebuild the project and use the freshly generated ABI (out/debug/<pkg>-abi.json) that matches the bytecode that emitted the logs","Ensure the ABI file you pass corresponds to the exact contract/script that produced the receipts","Keep forc toolchain and fuel-abi-types versions consistent between build and decode steps"],"exampleFix":"# before\necho 'log(\"x\")' >> src/main.sw; forc run --abi old_export-abi.json\n\n# after\nforc build && forc run --abi out/debug/my_pkg-abi.json","handlingStrategy":"validation","validationCode":"// Verify the ABI describes this log id before decoding.\nlet known: std::collections::HashSet<&str> = program_abi\n    .logged_types\n    .iter()\n    .flatten()\n    .map(|lt| lt.log_id.as_str())\n    .collect();\nif !known.contains(log_id) {\n    anyhow::bail!(\"ABI is stale: log id {log_id} not in logged_types — rebuild and use the fresh ABI\");\n}","typeGuard":"fn abi_covers_log_id(abi: &fuel_abi_types::abi::program::ProgramABI, id: &str) -> bool {\n    abi.logged_types\n        .iter()\n        .flatten()\n        .any(|lt| lt.log_id == id)\n}","tryCatchPattern":"match decode_log_data(log_id, log_data, program_abi) {\n    Ok(d) => Ok(d),\n    Err(e) if e.to_string() == \"log id is missing\" => {\n        eprintln!(\"skipping undeclared log {log_id}; raw: {}\", hex::encode(log_data));\n        continue;\n    }\n    Err(e) => return Err(e),\n}","preventionTips":["Always regenerate and pass the ABI produced by the same `forc build` as the bytecode under test","In scripts, `forc build` before any `forc run`/decode step instead of reusing checked-in ABI files"],"tags":["forc-util","abi","log-decoding","mismatch"],"backgroundTag":null,"analyzedSha":"47e5e902faa42baf652dd6a0c88cd23390c1a614","analyzedAt":"2026-08-16T07:57:45.555Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}