{"record":{"id":"080b9dce227f9481","repo":"FuelLabs/fuels-rs","slug":"log-id-should-be-a-valid-u64-string-080b9d","errorCode":null,"errorMessage":"log id should be a valid u64 string","messagePattern":"log id should be a valid u64 string","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/fuels-code-gen/src/program_bindings/custom_types/structs.rs","lineNumber":76,"sourceCode":"    struct_ident: &Ident,\n    components: &Components,\n    generics: &[Ident],\n    no_std: bool,\n    log_id: Option<&String>,\n) -> TokenStream {\n    let derive_default = components\n        .is_empty()\n        .then(|| quote!(::core::default::Default,));\n\n    let maybe_disable_std = no_std.then(|| quote! {#[NoStd]});\n\n    let (generics_wo_bounds, generics_w_bounds) = tokenize_generics(generics);\n    let (field_names, field_types): (Vec<_>, Vec<_>) = unzip_field_names_and_types(components);\n    let (phantom_fields, phantom_types) =\n        components.generate_parameters_for_unused_generics(generics);\n\n    let log_impl = log_id.map(|log_id| {\n        let log_id_u64: u64 = log_id.parse::<u64>().expect(\"log id should be a valid u64 string\");\n\n        quote! {\n            impl #generics_w_bounds ::fuels::core::codec::Log for #struct_ident #generics_wo_bounds {\n                const LOG_ID: &'static str = #log_id;\n                const LOG_ID_U64: u64 = #log_id_u64;\n            }\n        }\n    });\n\n    quote! {\n        #[derive(\n            Clone,\n            Debug,\n            Eq,\n            PartialEq,\n            #derive_default\n            ::fuels::macros::Parameterize,\n            ::fuels::macros::Tokenizable,","sourceCodeStart":58,"sourceCodeEnd":94,"githubUrl":"https://github.com/FuelLabs/fuels-rs/blob/d9a250a51818dda64bfeb5ef7cc19cf27bdcd623/packages/fuels-code-gen/src/program_bindings/custom_types/structs.rs#L58-L94","documentation":"Same codegen path as the enum case, but for struct types: when a struct is a logged type, abigen! parses the log id string from the ABI into u64 to emit the Log::LOG_ID_U64 constant (packages/fuels-code-gen/src/program_bindings/custom_types/structs.rs:76). The expect fires when the id string cannot be parsed as u64.","triggerScenarios":"abigen! on an ABI where the loggedTypes id attached to a struct type is not a decimal u64 string (corruption, manual edit, or forc/SDK version mismatch).","commonSituations":"Hand-edited ABIs; ABI files copied between projects built with different forc versions; partial rewrites of the JSON.","solutions":["Regenerate the ABI with forc build using the toolchain matched to your fuels crate","Verify the loggedTypes ids are plain decimal strings parseable as u64","Upgrade fuels to the version matching your ABI format"],"exampleFix":"// before\n\"loggedTypes\": [{ \"id\": \"log-1\", ... }]\n\n// after\n\"loggedTypes\": [{ \"id\": \"16423\", ... }]","handlingStrategy":"validation","validationCode":"# (shell) every loggedTypes id must round-trip through a u64\njq -e '[.loggedTypes[]?.id] | map(. == (.|tonumber|tostring)) | all' out/release/contract-abi.json","typeGuard":"fn valid_log_id(id: &str) -> bool {\n    id.parse::<u64>().is_ok()\n}","tryCatchPattern":null,"preventionTips":["Treat generated ABIs as build artifacts, never as editable files","Keep the forc/fuels version pair in sync","Validate the ABI in CI before compiling bindings"],"tags":["codegen","abigen","logging","compile-time","structs"],"backgroundTag":null,"analyzedSha":"d9a250a51818dda64bfeb5ef7cc19cf27bdcd623","analyzedAt":"2026-08-16T09:49:30.618Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}