{"record":{"id":"619029956e52e1f8","repo":"FuelLabs/fuels-ts","slug":"function-not-found-619029","errorCode":"FUNCTION_NOT_FOUND","errorMessage":"Function with name '${name}' doesn't exist in the ABI","messagePattern":"Function with name '(.+?)' doesn't exist in the ABI","errorType":"exception","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/abi-coder/src/utils/json-abi.ts","lineNumber":40,"sourceCode":"    default:\n      throw new FuelError(\n        ErrorCode.UNSUPPORTED_ENCODING_VERSION,\n        `Encoding version '${encoding}' is unsupported.`\n      );\n  }\n};\n\n/**\n * Find a function by name in the ABI.\n *\n * @param abi - the JsonAbi object\n * @param name - the name of the function to find\n * @returns the JsonAbi function object\n */\nexport const findFunctionByName = (abi: JsonAbi, name: string): AbiFunction => {\n  const fn = abi.functions.find((f) => f.name === name);\n  if (!fn) {\n    throw new FuelError(\n      ErrorCode.FUNCTION_NOT_FOUND,\n      `Function with name '${name}' doesn't exist in the ABI`\n    );\n  }\n  return fn;\n};\n\n/**\n * Find a type by its typeId in the ABI.\n *\n * @param abi - the JsonAbi object\n * @param typeId - the typeId of the type to find\n * @returns the JsonAbi type object\n */\nexport const findTypeById = (abi: JsonAbiOld, typeId: number): JsonAbiType => {\n  const type = abi.types.find((t) => t.typeId === typeId);\n  if (!type) {\n    throw new FuelError(","sourceCodeStart":22,"sourceCodeEnd":58,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/abi-coder/src/utils/json-abi.ts#L22-L58","documentation":"findFunctionByName linearly searches abi.functions for an entry whose name equals the supplied string. A miss means the requested function is not declared in the loaded ABI, so the SDK cannot resolve its input/output coders or encode a call to it.","triggerScenarios":"Calling interface.functions.<name>, contract.functions.<name>(...) or Invoker with a name not present in the ABI; loading the wrong ABI for the deployed contract; typo or case mismatch in the function name.","commonSituations":"ABI/contract address mismatch (pointing at contract A with ABI of contract B); renamed Sway function after recompile; case sensitivity (`Main` vs `main`); using a minified/older ABI artifact.","solutions":["Print abi.functions.map(f => f.name) to confirm the exact function name (and casing).","Ensure the ABI used by Interface/Contract matches the contract deployed at the target address.","Regenerate the ABI from current Sway source and reload it."],"exampleFix":"// before\nconst tx = contract.functions.myFunc(...); // typo / renamed\n\n// after\nconst names = contract.interface.jsonABI.functions.map(f => f.name);\nif (!names.includes('myFunc')) {\n  throw new Error(`function not in ABI. available: ${names.join(', ')}`);\n}\nconst tx = contract.functions.myFunc(...);","handlingStrategy":"validation","validationCode":"function ensureFunction(abi: JsonAbi, name: string) {\n  const fn = abi.functions.find(f => f.name === name);\n  if (!fn) {\n    const available = abi.functions.map(f => f.name).join(', ');\n    throw new Error(`function '${name}' not in ABI. available: ${available}`);\n  }\n  return fn;\n}","typeGuard":"function hasFunction(abi: JsonAbi, name: string): boolean {\n  return abi.functions.some(f => f.name === name);\n}","tryCatchPattern":null,"preventionTips":["Load the ABI that matches the deployed contract's address.","Regenerate the ABI whenever Sway function names change.","Remember function names are case-sensitive."],"tags":["abi","function-not-found","contract","abi-mismatch"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}