{"record":{"id":"2c7d7faec2c9c53c","repo":"FuelLabs/fuels-rs","slug":"only-one-wallets-command-allowed","errorCode":null,"errorMessage":"Only one `Wallets` command allowed","messagePattern":"Only one `Wallets` command allowed","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"packages/fuels-macros/src/setup_program_test/parsing/validations.rs","lineNumber":86,"sourceCode":"                Error::new(\n                    abigen_command.span,\n                    format!(\n                        \"Consider adding: Script(name=\\\"{}\\\", project=...)\",\n                        unknown_contract.value()\n                    ),\n                ),\n            ]\n        })\n        .validate_no_errors()\n}\n\npub(crate) fn validate_zero_or_one_wallet_command_present(\n    commands: &[InitializeWalletCommand],\n) -> Result<()> {\n    if commands.len() > 1 {\n        commands\n            .iter()\n            .map(|command| Error::new(command.span, \"Only one `Wallets` command allowed\"))\n            .combine_errors()\n            .map(Err)\n            .expect(\"Known to have at least one error\")\n    } else {\n        Ok(())\n    }\n}\n\nfn names_of_program_bindings(\n    commands: &AbigenCommand,\n    program_type: ProgramType,\n) -> HashSet<&LitStr> {\n    commands\n        .targets\n        .iter()\n        .filter_map(|target| (target.program_type == program_type).then_some(&target.name))\n        .collect()\n}","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/FuelLabs/fuels-rs/blob/d9a250a51818dda64bfeb5ef7cc19cf27bdcd623/packages/fuels-macros/src/setup_program_test/parsing/validations.rs#L68-L104","documentation":"Compile-time validation error from setup_program_test: validate_zero_or_one_wallet_command_present found more than one Wallets(...) command. The macro allows at most one wallet-initialization command; every extra occurrence gets an error on its span and all are combined into one report.","triggerScenarios":"Two or more Wallets(..) blocks in a single setup_program_test! invocation — commonly the original block plus a pasted one when merging tests, or a duplicated block after a bad merge conflict resolution.","commonSituations":"Combining two tests by pasting both bodies into one invocation; incremental edits appending a Wallets block instead of editing the existing one.","solutions":["Keep a single Wallets(...) command and express all wallets you need inside it (e.g. Wallets([alice, bob])).","Delete the duplicated block entirely rather than commenting it out (leftover copies keep triggering the check).","Recompile to confirm validation passes."],"exampleFix":"// before\nsetup_program_test!(\n    Wallets([alice]),\n    Wallets([bob]),\n)\n// after\nsetup_program_test!(\n    Wallets([alice, bob]),\n)","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Declare all wallets in a single Wallets([...]) command.","cargo check after merging test bodies to catch duplicated command blocks.","Delete, do not comment out, superseded Wallets blocks."],"tags":["rust","macro","compile-time","setup-program-test","wallets"],"backgroundTag":null,"analyzedSha":"d9a250a51818dda64bfeb5ef7cc19cf27bdcd623","analyzedAt":"2026-08-16T09:49:30.618Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}