{"record":{"id":"d382588a8026f35f","repo":"FuelLabs/fuels-rs","slug":"unrecognized-command-expected-one-of-msg","errorCode":null,"errorMessage":"Unrecognized command. Expected one of: {msg}","messagePattern":"Unrecognized command\\. Expected one of: (.+?)","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"packages/fuels-macros/src/setup_program_test/parsing/command_parser.rs","lineNumber":19,"sourceCode":"macro_rules! command_parser {\n    ($($command_name: ident -> $command_struct: ty),+ $(,)?) => {\n        #[derive(Default)]\n        #[allow(non_snake_case)]\n        pub(crate) struct CommandParser {\n            $(pub(crate) $command_name: Vec<$command_struct>),*\n        }\n\n        impl CommandParser {\n            fn available_commands() -> impl Iterator<Item=&'static str> {\n                [$(stringify!($command_name)),*].into_iter()\n            }\n\n            pub(crate) fn parse_and_save(&mut self, command: $crate::parse_utils::Command) -> ::syn::Result<()>{\n                match command.name.to_string().as_str() {\n                    $(stringify!($command_name) => self.$command_name.push(command.try_into()?),)*\n                    _ => {\n                        let msg = Self::available_commands().map(|command| format!(\"'{command}'\")).join(\", \");\n                        return Err(::syn::Error::new(command.name.span(), format!(\"Unrecognized command. Expected one of: {msg}\")));\n                    }\n                };\n                Ok(())\n            }\n        }\n\n        impl Parse for CommandParser {\n            fn parse(input: ::syn::parse::ParseStream) -> Result<Self> {\n                use $crate::parse_utils::ErrorsExt;\n                let mut command_parser = Self::default();\n\n                let mut errors = vec![];\n                for command in $crate::parse_utils::Command::parse_multiple(input)? {\n                    if let Err(error) = command_parser.parse_and_save(command) {\n                        errors.push(error);\n                    }\n                }\n","sourceCodeStart":1,"sourceCodeEnd":37,"githubUrl":"https://github.com/FuelLabs/fuels-rs/blob/d9a250a51818dda64bfeb5ef7cc19cf27bdcd623/packages/fuels-macros/src/setup_program_test/parsing/command_parser.rs#L1-L37","documentation":"Compile-time error from the setup_program_test macro's command parser: the first token of a command inside the macro invocation was matched against the fixed list of available commands (generated via stringify! of the macro's command list) and did not match any of them. The message lists every accepted command name for the invocation site.","triggerScenarios":"Inside setup_program_test!(...), writing a command name that is not one of the registered ones — a typo (Wallet instead of Wallets), wrong casing (deployContract vs DeployContract), or a command that belongs to a different macro/version (e.g. using LoadScript syntax on a version where it is not registered).","commonSituations":"Copy-pasting setup blocks from older fuels versions whose command names changed; guessing command names instead of checking the list in the error; typos in camel-case command identifiers.","solutions":["Read the message: it enumerates the exact accepted commands ('Abigen', 'Wallets', 'DeployContract', ...).","Fix the command identifier to match one from the list exactly (spelling and casing).","If the command genuinely should exist, you are probably on a different SDK version — upgrade/downgrade to the version whose macro supports it, or restructure the test to use the runtime API instead.","Keep one canonical example setup_program_test block as a template to avoid regressions."],"exampleFix":"// before\nsetup_program_test!(\n    Wallets([wallet]),\n    DeployContract(name = \"counter\", salt = ...),\n)\n// after\nsetup_program_test!(\n    Wallets([wallet]),\n    DeployContract(name = \"counter\"),\n)","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["The error message enumerates valid commands — copy the exact identifier from it.","Pin to one SDK version across the workspace so command vocabularies stay consistent.","Watch casing: commands are CamelCase plurals like 'Wallets', not 'Wallet'."],"tags":["rust","macro","compile-time","setup-program-test","command-parsing"],"backgroundTag":null,"analyzedSha":"d9a250a51818dda64bfeb5ef7cc19cf27bdcd623","analyzedAt":"2026-08-16T09:49:30.618Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}