{"record":{"id":"c6b180249eb8a4fd","repo":"FuelLabs/fuels-ts","slug":"contract-not-found","errorCode":null,"errorMessage":"Contract not found!","messagePattern":"Contract not found!","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"warning","filePath":"apps/demo-fuels/fuels.config.full.ts","lineNumber":69,"sourceCode":"  // Default: []\n  forcBuildFlags: ['--release'],\n  // #endregion forcBuildFlags\n\n  // #region deployConfig-fn\n  deployConfig: async (options: ContractDeployOptions) => {\n    // ability to fetch data remotely\n    await Promise.resolve(`simulating remote data fetch`);\n\n    // get contract by name\n    const { contracts } = options;\n\n    const contract = contracts.find(({ name }) => {\n      const found = name === MY_FIRST_DEPLOYED_CONTRACT_NAME;\n      return found;\n    });\n\n    if (!contract) {\n      throw new Error('Contract not found!');\n    }\n\n    return {\n      storageSlots: [\n        {\n          key: '0x..',\n          /**\n           * Here we could initialize a storage slot,\n           * using the relevant contract ID.\n           */\n          value: contract.contractId,\n        },\n      ],\n    };\n  },\n  // #endregion deployConfig-fn\n\n  // #region onBuild","sourceCodeStart":51,"sourceCodeEnd":87,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/apps/demo-fuels/fuels.config.full.ts#L51-L87","documentation":"Thrown by the deployConfig callback in the demo fuels config when no deployed contract in `options.contracts` matches the `MY_FIRST_DEPLOYED_CONTRACT_NAME` constant. The callback needs the matching contract's `contractId` to populate a storage slot, so it refuses to proceed without one. This is example code, not library runtime logic — the constant ships as an empty string and is meant to be filled in.","triggerScenarios":"Running `fuels deploy` (or the demo's build/deploy flow) while `MY_FIRST_DEPLOYED_CONTRACT_NAME` is still the default empty string, or after renaming a Sway contract so the constant no longer matches any `name` in `options.contracts`. Also fires if the workspace has zero contracts deployed.","commonSituations":"Copying the demo config as a starting template but forgetting to set the constant; renaming a contract project folder without updating the constant; pointing `contracts:` globs at a directory whose compiled contract names differ from the constant.","solutions":["Set `MY_FIRST_DEPLOYED_CONTRACT_NAME` to the exact Sway contract name (the `project.name` in `Forc.toml`, also the generated TypeScript class name) of a contract in the configured workspace.","Log `options.contracts.map(c => c.name)` first to see the available names, then copy one into the constant.","If you do not need storage-slot initialization, replace the `deployConfig` callback with an object (`deployConfig: {}`) or remove it entirely."],"exampleFix":"// before\nconst MY_FIRST_DEPLOYED_CONTRACT_NAME = '';\n// after\nconst MY_FIRST_DEPLOYED_CONTRACT_NAME = 'my_contract'; // must match a contract name in options.contracts","handlingStrategy":"validation","validationCode":"// inside deployConfig, before find():\nconst { contracts } = options;\nconst validNames = contracts.map((c) => c.name);\nif (!validNames.includes(MY_FIRST_DEPLOYED_CONTRACT_NAME)) {\n  throw new Error(\n    `Contract '${MY_FIRST_DEPLOYED_CONTRACT_NAME}' not found. Available: ${validNames.join(', ')}`\n  );\n}","typeGuard":null,"tryCatchPattern":"try {\n  // deployConfig body\n} catch (e) {\n  if (e.message === 'Contract not found!') {\n    throw new Error(`Contract not found. Available: ${options.contracts.map(c => c.name).join(', ')}`);\n  }\n  throw e;\n}","preventionTips":["Treat `MY_FIRST_DEPLOYED_CONTRACT_NAME` as a required template variable — fail fast at config load if it is empty.","Derive the constant from `options.contracts` at runtime instead of hardcoding a string literal.","If storage-slot init is optional, return early when no contract matches instead of throwing."],"tags":["demo-config","fuels-config","deployment","config"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}