{"record":{"id":"2c7553aaa6bb44f2","repo":"FuelLabs/fuels-rs","slug":"consider-adding-contract-name-project","errorCode":null,"errorMessage":"Consider adding: Contract(name=\"{}\", project=...)","messagePattern":"Consider adding: Contract\\(name=\"(.+?)\", project=\\.\\.\\.\\)","errorType":"validation","errorClass":"syn::Error","httpStatus":null,"severity":"error","filePath":"packages/fuels-macros/src/setup_program_test/parsing/validations.rs","lineNumber":44,"sourceCode":"\n            Err(err)\n        }\n    }\n}\n\npub(crate) fn validate_all_contracts_are_known(\n    abigen_command: &AbigenCommand,\n    deploy_commands: &[DeployContractCommand],\n) -> Result<()> {\n    extract_contracts_to_deploy(deploy_commands)\n        .difference(&names_of_program_bindings(\n            abigen_command,\n            ProgramType::Contract,\n        ))\n        .flat_map(|unknown_contract| {\n            [\n                Error::new_spanned(unknown_contract, \"Contract is unknown\"),\n                Error::new(\n                    abigen_command.span,\n                    format!(\n                        \"Consider adding: Contract(name=\\\"{}\\\", project=...)\",\n                        unknown_contract.value()\n                    ),\n                ),\n            ]\n        })\n        .validate_no_errors()\n}\n\npub(crate) fn validate_all_scripts_are_known(\n    abigen_command: &AbigenCommand,\n    load_commands: &[LoadScriptCommand],\n) -> Result<()> {\n    extract_scripts_to_load(load_commands)\n        .difference(&names_of_program_bindings(\n            abigen_command,","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/FuelLabs/fuels-rs/blob/d9a250a51818dda64bfeb5ef7cc19cf27bdcd623/packages/fuels-macros/src/setup_program_test/parsing/validations.rs#L26-L62","documentation":"Compile-time validation error from setup_program_test: a DeployContract command references a contract binding name that is not produced by the Abigen command. validate_all_contracts_are_known takes the set difference of names being deployed vs contract bindings declared under ProgramType::Contract; each unknown name yields two errors — one on the name literal ('Contract is unknown') and this one on the Abigen span suggesting the fix.","triggerScenarios":"DeployContract(name = \"my_contract\") where the Abigen command has no contract binding named \"my_contract\" (typo, casing mismatch, or the binding exists only under scripts/predicates rather than contracts), or the name was copy-pasted from another test.","commonSituations":"Renaming a binding in Abigen but not in DeployContract; deploying a binding that was declared as the wrong program type; stale copied test scaffolding.","solutions":["Make the DeployContract name string exactly match a contract binding name in Abigen (case-sensitive).","If the contract is genuinely missing, add it: Abigen(contracts = [(name = \"my_contract\", project = \"...\")]) as the message suggests.","Verify the program is listed under contracts= and not scripts=/predicates= in the Abigen command."],"exampleFix":"// before\nsetup_program_test!(\n    Abigen(contracts = [(name = \"counter\", project = \"../counter\")]),\n    DeployContract(name = \"ctr\", salt = \"0x00\"),\n)\n// after\nsetup_program_test!(\n    Abigen(contracts = [(name = \"counter\", project = \"../counter\")]),\n    DeployContract(name = \"counter\"),\n)","handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Use one identifier per program and reference it verbatim in DeployContract/LoadScript.","Rename bindings and their usages in the same commit; grep the invocation for the old name.","Remember names are case-sensitive string literals, not Rust identifiers."],"tags":["rust","macro","compile-time","setup-program-test","deploy"],"backgroundTag":null,"analyzedSha":"d9a250a51818dda64bfeb5ef7cc19cf27bdcd623","analyzedAt":"2026-08-16T09:49:30.618Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}