{"record":{"id":"553e59f0cc72e43d","repo":"FuelLabs/fuels-ts","slug":"invalid-transaction-input","errorCode":"INVALID_TRANSACTION_INPUT","errorMessage":"Invalid transaction input type: ${type}.","messagePattern":"Invalid transaction input type: (.+?)\\.","errorType":"validation","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/account/src/providers/transaction-request/input.ts","lineNumber":152,"sourceCode":"      const data = arrayify(value.data ?? '0x');\n      return {\n        type: InputType.Message,\n        sender: hexlify(value.sender),\n        recipient: hexlify(value.recipient),\n        amount: bn(value.amount),\n        nonce: hexlify(value.nonce),\n        witnessIndex: value.witnessIndex,\n        predicateGasUsed: bn(value.predicateGasUsed),\n        predicateLength: bn(predicate.length),\n        predicateDataLength: bn(predicateData.length),\n        predicate: hexlify(predicate),\n        predicateData: hexlify(predicateData),\n        data: hexlify(data),\n        dataLength: data.length,\n      };\n    }\n    default: {\n      throw new FuelError(\n        ErrorCode.INVALID_TRANSACTION_INPUT,\n        `Invalid transaction input type: ${type}.`\n      );\n    }\n  }\n};\n","sourceCodeStart":134,"sourceCodeEnd":159,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/account/src/providers/transaction-request/input.ts#L134-L159","documentation":"Thrown by the `inputify` helper when serializing a transaction input whose `type` field does not match any known `InputType` enum value (Coin, Contract, or Message). The SDK walks a switch over the input's discriminator and falls through to the default branch, meaning the value supplied is not a constructible transaction request input. This typically signals a corrupted, hand-built, or version-mismatched input object passed into transaction construction or deserialization.","triggerScenarios":"Calling `inputify()` (directly or via `TransactionRequest.from()` / `transactionRequestify()`) with an input object whose `type` is undefined, numeric value outside the InputType enum, or a string instead of the enum. Occurs when the `default` branch of the switch in input.ts:151 is reached.","commonSituations":"Constructing a transaction request from a plain JSON object where the `type` field was dropped or renamed; upgrading the SDK across a version that changed the InputType enum values; deserializing a transaction payload produced by a different/incompatible Fuel tool version; passing an `InputResource` that was not normalized to the expected shape.","solutions":["Inspect the offending input object's `type` field and ensure it equals one of InputType.Coin (0), InputType.Contract (1), or InputType.Message (2).","If building inputs from JSON, use the `TransactionRequestLike` types and the SDK's `from()` factory methods instead of assembling raw input objects manually.","Verify the @fuel-ts/account and @fuel-ts/transactions versions are aligned across your dependency tree (run `pnpm why @fuel-ts/transactions`).","When deserializing, confirm the raw payload was encoded by a compatible coder version."],"exampleFix":"// before\nconst input = { owner: alice.address, amount: 1000, assetId: '0x...' };\n// after\nimport { InputType } from '@fuel-ts/transactions';\nconst input = {\n  type: InputType.Coin,\n  owner: alice.address,\n  amount: 1000,\n  assetId: '0x...',\n  txPointer: { blockHeight: 0, txIndex: 0 },\n  witnessIndex: 0,\n  predicateLength: 0,\n  predicateDataLength: 0,\n  predicate: '0x',\n  predicateData: '0x',\n  predicateGasUsed: 0,\n};","handlingStrategy":"type-guard","validationCode":"import { InputType } from '@fuel-ts/transactions';\nconst KNOWN_INPUT_TYPES = new Set([InputType.Coin, InputType.Contract, InputType.Message]);\nfunction isValidInputType(t: unknown): t is InputType {\n  return typeof t === 'number' && KNOWN_INPUT_TYPES.has(t);\n}\nif (!isValidInputType(input.type)) throw new Error(`bad input type ${input.type}`);","typeGuard":"function isTransactionRequestInput(v: unknown): v is import('@fuel-ts/transactions').TransactionRequestInput {\n  return typeof v === 'object' && v !== null && 'type' in v &&\n    [0,1,2].includes((v as any).type);\n}","tryCatchPattern":"try { request.addInput(inputify(rawInput)); } catch (e) { if (e.code === ErrorCode.INVALID_TRANSACTION_INPUT) { /* log and skip bad input */ } else throw e; }","preventionTips":["Always construct inputs via the SDK's typed factories, never plain literals.","Keep @fuel-ts package versions aligned so InputType enum values match.","Add a runtime type guard before deserializing inputs from untrusted JSON."],"tags":["transaction","serialization","input-validation","typescript"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}