{"record":{"id":"e76a82a52fa6340c","repo":"FuelLabs/fuels-ts","slug":"transaction-error-e76a82","errorCode":"TRANSACTION_ERROR","errorMessage":"The target function ${this.func.name} cannot accept forwarded funds as it's not marked as 'payable'.","messagePattern":"The target function (.+?) cannot accept forwarded funds as it's not marked as 'payable'\\.","errorType":"exception","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/program/src/functions/invocation-scope.ts","lineNumber":84,"sourceCode":"    return this;\n  }\n\n  /**\n   * Sets the call parameters for the function invocation.\n   *\n   * @param callParams - The call parameters.\n   * @returns The instance of FunctionInvocationScope.\n   * @throws If the function is not payable and forward is set.\n   */\n  callParams(callParams: CallParams) {\n    if (!this.hasCallParamsGasLimit && callParams?.gasLimit !== undefined) {\n      this.hasCallParamsGasLimit = true;\n    }\n    this.callParameters = callParams;\n\n    if (callParams?.forward) {\n      if (!this.func.attributes.find((attr) => attr.name === 'payable')) {\n        throw new FuelError(\n          ErrorCode.TRANSACTION_ERROR,\n          `The target function ${this.func.name} cannot accept forwarded funds as it's not marked as 'payable'.`\n        );\n      }\n\n      this.forward = coinQuantityfy(callParams.forward);\n    }\n\n    // Update transaction script with new forward params\n    this.setArguments(...this.args);\n\n    // Update required coins\n    this.updateRequiredCoins();\n\n    return this;\n  }\n}\n","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/program/src/functions/invocation-scope.ts#L66-L102","documentation":"Thrown by FunctionInvocationScope.callParams() when a `forward` amount is supplied but the target Sway function's ABI attributes do not include 'payable'. Forwarding native coins to a contract call requires the Sway function to be annotated #[payable]; without it the VM would reject the funds, so the SDK blocks it up front.","triggerScenarios":"Calling .callParams({ forward: [amount, assetId] }) on a function whose ABI has no payable attribute; forwarding to a read/View or non-payable function; ABI regenerated from a contract where #[payable] was removed.","commonSituations":"Depositing or paying into a function that the developer forgot to mark #[payable] in Sway; using the wrong ABI (stale typegen) where payable was stripped; sending base asset to a pure function.","solutions":["Mark the Sway function #[payable] (storage(read, write) may also be needed) and redeploy + regenerate types.","If you did not intend to send coins, remove the `forward` entry from callParams.","Re-run typegen against the current contract ABI to ensure the payable attribute is present in the JSON ABI used by the SDK."],"exampleFix":"// Sway\n// before\nentry fn deposit(amount: u64) { ... }\n// after\n#[payable]\nentry fn deposit(amount: u64) { ... }","handlingStrategy":"validation","validationCode":"function isPayable(func: { attributes: Array<{ name: string }> }): boolean {\n  return !!func.attributes?.some((a) => a.name === 'payable');\n}\n\nif (callParams?.forward && !isPayable(scope.func)) {\n  throw new Error(`${scope.func.name} is not payable; remove forward or mark it #[payable] in Sway.`);\n}","typeGuard":"function isPayableFunction(func: { attributes: Array<{ name: string }> }): boolean {\n  return !!func.attributes?.some((a) => a.name === 'payable');\n}","tryCatchPattern":"try {\n  await contract.functions.deposit().callParams({ forward: [amt, assetId] }).call();\n} catch (e) {\n  if (e instanceof FuelError && e.code === ErrorCode.TRANSACTION_ERROR && /payable/.test(e.message)) {\n    // mark the Sway function #[payable], redeploy, regenerate types\n  } else throw e;\n}","preventionTips":["Annotate receiving Sway functions with #[payable] before exposing a deposit path.","Regenerate types after changing payable attributes so the SDK ABI reflects them.","Only pass forward for functions you know are payable."],"tags":["payable","abi","forward","sway","typescript"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}