{"record":{"id":"894fc6498fbdabd6","repo":"FuelLabs/fuels-rs","slug":"log-id-should-be-a-valid-u64-string","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/enums.rs","lineNumber":86,"sourceCode":"\nfn enum_decl(\n    enum_ident: &Ident,\n    components: &Components,\n    generics: &[Ident],\n    no_std: bool,\n    log_id: Option<&String>,\n) -> TokenStream {\n    let maybe_disable_std = no_std.then(|| quote! {#[NoStd]});\n\n    let enum_variants = components.as_enum_variants();\n    let unused_generics_variant = components.generate_variant_for_unused_generics(generics);\n    let (generics_wo_bounds, generics_w_bounds) = tokenize_generics(generics);\n    let maybe_impl_error = maybe_impl_error(enum_ident, components);\n\n    let log_impl = log_id.map(|log_id| {\n        let log_id_u64: u64 = log_id\n            .parse::<u64>()\n            .expect(\"log id should be a valid u64 string\");\n\n        quote! {\n            impl #generics_w_bounds ::fuels::core::codec::Log for #enum_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        #[allow(clippy::enum_variant_names)]\n        #[derive(\n            Clone,\n            Debug,\n            Eq,\n            PartialEq,\n            ::fuels::macros::Parameterize,\n            ::fuels::macros::Tokenizable,","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/FuelLabs/fuels-rs/blob/d9a250a51818dda64bfeb5ef7cc19cf27bdcd623/packages/fuels-code-gen/src/program_bindings/custom_types/enums.rs#L68-L104","documentation":"In abigen! codegen, when an enum is also a logged type, the SDK takes the log id string from the ABI's loggedTypes entry and parses it into u64 to emit the Log::LOG_ID_U64 constant (enums path, packages/fuels-code-gen/src/program_bindings/custom_types/enums.rs:86). The expect fires when that id string is not a valid decimal u64.","triggerScenarios":"abigen! on an ABI where the loggedTypes id for an enum type is not a plain decimal u64 string: corrupted JSON, a hand-edited id, or an ABI format written by an incompatible forc version.","commonSituations":"Editing the ABI by hand; mixing ABI files produced by different forc versions; tooling that rewrites or reformats ids.","solutions":["Regenerate the ABI with forc build using the toolchain version matched to your fuels crate","Inspect the loggedTypes ids in the JSON and make sure they are plain decimal number strings (e.g. \"12345\")","Upgrade fuels to the version that supports your ABI format"],"exampleFix":"// before: hand-edited ABI with a mangled log id\n\"loggedTypes\": [{ \"id\": \"0x2a\", ... }]\n\n// after: plain decimal u64 string, regenerated by forc\n\"loggedTypes\": [{ \"id\": \"42\", ... }]","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":["Regenerate ABIs with forc instead of editing them","Pin forc and fuels to a matched version pair","Add a CI lint that validates loggedTypes ids before cargo build"],"tags":["codegen","abigen","logging","compile-time","enums"],"backgroundTag":null,"analyzedSha":"d9a250a51818dda64bfeb5ef7cc19cf27bdcd623","analyzedAt":"2026-08-16T09:49:30.618Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}