{"record":{"id":"3df9f3099b785d05","repo":"FuelLabs/fuels-ts","slug":"unknown","errorCode":"UNKNOWN","errorMessage":"No change output found","messagePattern":"No change output found","errorType":"exception","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/account/src/utils/consolidate-coins.ts","lineNumber":93,"sourceCode":"  return { coins: all };\n};\n\n/** @hidden */\nconst sortCoins = ({ coins }: { coins: Coin[] }) => coins.sort((a, b) => b.amount.cmp(a.amount));\n\n/** @hidden */\nconst createOuputCoin = (opts: {\n  transactionId: string;\n  outputs: Output[];\n  baseAssetId: string;\n}): Coin => {\n  const { transactionId, outputs, baseAssetId } = opts;\n\n  const outputChangeIndex = outputs.findIndex(\n    (output) => output.type === OutputType.Change && output.assetId === baseAssetId\n  );\n  if (outputChangeIndex === -1) {\n    throw new FuelError(ErrorCode.UNKNOWN, 'No change output found');\n  }\n\n  const outputCoin = outputs[outputChangeIndex] as OutputChange;\n\n  // Format the UTXO ID\n  const outputIndexPadded = Number(outputChangeIndex).toString().padStart(4, '0');\n\n  return {\n    id: `${transactionId}${outputIndexPadded}`,\n    assetId: outputCoin.assetId,\n    amount: outputCoin.amount,\n    owner: new Address(outputCoin.to),\n    blockCreated: bn(0),\n    txCreatedIdx: bn(0),\n  };\n};\n\nexport const consolidateCoins = async ({","sourceCodeStart":75,"sourceCodeEnd":111,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/account/src/utils/consolidate-coins.ts#L75-L111","documentation":"Internal error from createOuputCoin() in the coin-consolidation pipeline. It scans a transaction's outputs for an output whose type is OutputType.Change AND whose assetId equals the base asset id; finding none, it cannot derive the funding coin for the next consolidation batch. This is a library-internal invariant, not a user-config error.","triggerScenarios":"Reached via consolidateCoins -> submitAll when the previous batch's transaction result has no Change output for the base asset. This typically happens if the transaction was built without a base-asset change variable (e.g. custom ScriptTransactionRequest manipulation, or a malformed predicate flow that strips change outputs).","commonSituations":"Manually editing the consolidation transaction request; a chain or provider version change altering default output injection; consolidating a non-base asset where the previous tx lacked base-asset change due to zero fee; maxInputs boundary conditions producing empty batches.","solutions":["Do not manually strip change outputs from consolidation transactions; let consolidateCoins build them.","Ensure the account has base-asset funds to cover fees so a Change output for the base asset is created.","If hitting this after a SDK upgrade, check whether ScriptTransactionRequest change-variable injection behavior changed.","Report as an SDK bug if reached through the public consolidateCoins API without manual intervention."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  await result.submitAll();\n} catch (err) {\n  if (err instanceof FuelError && err.message === 'No change output found') {\n    // do not retry blindly; inspect the constructed tx for missing change outputs\n  }\n  throw err;\n}","preventionTips":["Do not manually remove change outputs from consolidation transactions.","Keep the account funded with base asset so change outputs are produced.","Pin the SDK version; consolidation internals can change between releases."],"tags":["consolidation","utxo","internal","transaction","account"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}