{"record":{"id":"f08275d0dce16f8f","repo":"FuelLabs/fuels-ts","slug":"unsupported-transaction-type","errorCode":"UNSUPPORTED_TRANSACTION_TYPE","errorMessage":"Unsupported transaction type: ${type}.","messagePattern":"Unsupported transaction type: (.+?)\\.","errorType":"validation","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/account/src/providers/transaction-request/utils.ts","lineNumber":42,"sourceCode":"\n  switch (obj.type) {\n    case TransactionType.Script: {\n      return ScriptTransactionRequest.from(obj);\n    }\n    case TransactionType.Create: {\n      return CreateTransactionRequest.from(obj);\n    }\n    case TransactionType.Blob: {\n      return BlobTransactionRequest.from(obj);\n    }\n    case TransactionType.Upgrade: {\n      return UpgradeTransactionRequest.from(obj);\n    }\n    case TransactionType.Upload: {\n      return UploadTransactionRequest.from(obj);\n    }\n    default: {\n      throw new FuelError(\n        ErrorCode.UNSUPPORTED_TRANSACTION_TYPE,\n        `Unsupported transaction type: ${type}.`\n      );\n    }\n  }\n};\n\n/** @hidden */\nexport const isTransactionTypeScript = (\n  request: TransactionRequestLike\n): request is ScriptTransactionRequest => request.type === TransactionType.Script;\n\n/** @hidden */\nexport const isTransactionTypeCreate = (\n  request: TransactionRequestLike\n): request is CreateTransactionRequest => request.type === TransactionType.Create;\n\n/** @hidden */","sourceCodeStart":24,"sourceCodeEnd":60,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/account/src/providers/transaction-request/utils.ts#L24-L60","documentation":"Thrown by `transactionRequestify(obj)` (utils.ts) when the object's `type` is not one of the known `TransactionType` values (Script, Create, Blob, Upgrade, Upload). The factory switches on the discriminator to pick the correct request subclass; the default branch rejects anything unrecognized so an invalid type does not silently produce a wrong subclass.","triggerScenarios":"Calling `transactionRequestify()` or `TransactionRequest.from()` on an object whose `type` is missing, numeric value outside the enum, or a string. This helper is the generic deserialization entry point from plain objects.","commonSituations":"Restoring a transaction from persisted JSON that lost the `type` field; cross-version deserialization where TransactionType enum values changed; passing a partially-built request object that was never assigned a type.","solutions":["Ensure the object passed to `transactionRequestify` has a valid `type` from TransactionType (Script=0, Create=1, Blob=2, Upgrade=3, Upload=4).","Prefer constructing requests with the concrete subclass constructors (ScriptTransactionRequest, CreateTransactionRequest, etc.) which set the type internally.","Round-trip test serialization/deserialization to confirm the `type` survives persistence."],"exampleFix":"// before\nconst req = transactionRequestify({ gasLimit: 1000, script: '0x...' }); // no type\n// after\nimport { TransactionType } from '@fuel-ts/transactions';\nconst req = transactionRequestify({\n  type: TransactionType.Script,\n  gasLimit: 1000,\n  script: '0x...',\n});","handlingStrategy":"type-guard","validationCode":"import { TransactionType } from '@fuel-ts/transactions';\nconst KNOWN_TX = new Set([TransactionType.Script, TransactionType.Create, TransactionType.Blob, TransactionType.Upgrade, TransactionType.Upload]);\nif (!KNOWN_TX.has(obj.type)) throw new Error(`unsupported tx type ${obj.type}`);","typeGuard":"function isTransactionRequestLike(v: unknown): v is import('@fuel-ts/transactions').TransactionRequestLike {\n  return typeof v === 'object' && v !== null && 'type' in v &&\n    [0,1,2,3,4].includes((v as any).type);\n}","tryCatchPattern":"null","preventionTips":["Prefer concrete subclass constructors over transactionRequestify for new requests.","Round-trip test serialization to confirm the type field survives.","Validate persisted JSON before deserializing."],"tags":["transaction","deserialization","type-validation","typescript"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}