{"record":{"id":"664dc8406e9660b4","repo":"FuelLabs/fuels-ts","slug":"invalid-transaction-input-664dc8","errorCode":"INVALID_TRANSACTION_INPUT","errorMessage":"Invalid transaction output type: ${type}.","messagePattern":"Invalid transaction output type: (.+?)\\.","errorType":"validation","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/account/src/providers/transaction-request/output.ts","lineNumber":99,"sourceCode":"      };\n    }\n    case OutputType.Variable: {\n      return {\n        type: OutputType.Variable,\n        to: hexlify(value.to || ZeroBytes32),\n        amount: bn(value.amount),\n        assetId: hexlify(value.assetId || ZeroBytes32),\n      };\n    }\n    case OutputType.ContractCreated: {\n      return {\n        type: OutputType.ContractCreated,\n        contractId: hexlify(value.contractId),\n        stateRoot: hexlify(value.stateRoot),\n      };\n    }\n    default: {\n      throw new FuelError(\n        ErrorCode.INVALID_TRANSACTION_INPUT,\n        `Invalid transaction output type: ${type}.`\n      );\n    }\n  }\n};\n","sourceCodeStart":81,"sourceCodeEnd":106,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/account/src/providers/transaction-request/output.ts#L81-L106","documentation":"Thrown by the `outputify` helper when serializing a transaction output whose `type` does not match any known `OutputType` (Coin, Contract, Change, Variable, ContractCreated). Note: the error code is `INVALID_TRANSACTION_INPUT` (a likely copy-paste defect in the SDK; the message correctly says 'output'). The default branch of the switch in output.ts:98 is reached only when the discriminator is unrecognized.","triggerScenarios":"Calling `outputify()` or `TransactionRequest.from()` with an output object whose `type` is undefined or outside the OutputType enum. Reaching output.ts:98 default branch during serialization of a transaction request to a chain-ready transaction.","commonSituations":"Hand-constructing output objects without setting `type`; version skew where OutputType enum values changed; serializing a transaction built by an older SDK that lacks newer output types; passing an output shaped like a `Coin` but missing the discriminator field.","solutions":["Ensure every output object carries a valid `type` from the OutputType enum (Coin=0, Contract=1, Change=2, Variable=3, ContractCreated=4).","Use the SDK's transaction request builders (e.g. `ScriptTransactionRequest.addOutput()`) which set the type automatically, rather than raw object literals.","Align @fuel-ts package versions so enum values match across serialization and deserialization.","If you see this error, also note the error code is mislabeled as INPUT but the fault is with an output."],"exampleFix":"// before\nrequest.outputs.push({ to: alice.address, amount: 1000, assetId: '0x...' });\n// after\nimport { OutputType } from '@fuel-ts/transactions';\nrequest.outputs.push({\n  type: OutputType.Coin,\n  to: alice.address,\n  amount: 1000,\n  assetId: '0x...',\n});","handlingStrategy":"type-guard","validationCode":"import { OutputType } from '@fuel-ts/transactions';\nconst KNOWN = new Set([OutputType.Coin, OutputType.Contract, OutputType.Change, OutputType.Variable, OutputType.ContractCreated]);\nif (!KNOWN.has(output.type)) throw new Error(`bad output type ${output.type}`);","typeGuard":"function isTransactionRequestOutput(v: unknown): v is import('@fuel-ts/transactions').TransactionRequestOutput {\n  return typeof v === 'object' && v !== null && 'type' in v &&\n    [0,1,2,3,4].includes((v as any).type);\n}","tryCatchPattern":"try { request.addOutput(outputify(rawOutput)); } catch (e) { if (e.code === ErrorCode.INVALID_TRANSACTION_INPUT && /output/i.test(e.message)) { /* skip */ } else throw e; }","preventionTips":["Use request.addOutput with strongly-typed output objects.","Note the error code is INVALID_TRANSACTION_INPUT but the fault is an output — inspect the message.","Validate the type discriminator before serialization."],"tags":["transaction","serialization","output-validation","typescript"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}