{"record":{"id":"964129f6541a9642","repo":"FuelLabs/fuels-ts","slug":"invalid-transaction-input-964129","errorCode":"INVALID_TRANSACTION_INPUT","errorMessage":"Contract input should be of type 'contract'.","messagePattern":"Contract input should be of type 'contract'\\.","errorType":"validation","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/account/src/providers/transaction-summary/input.ts","lineNumber":117,"sourceCode":"  return undefined;\n}\n\n/** @hidden */\nexport function getInputContractFromIndex(\n  inputs: Input[],\n  inputIndex: number\n): InputContract | undefined {\n  if (inputIndex == null) {\n    return undefined;\n  }\n\n  const contractInput = inputs?.[inputIndex];\n\n  if (!contractInput) {\n    return undefined;\n  }\n  if (contractInput.type !== InputType.Contract) {\n    throw new FuelError(\n      ErrorCode.INVALID_TRANSACTION_INPUT,\n      `Contract input should be of type 'contract'.`\n    );\n  }\n\n  return contractInput as InputContract;\n}\n\n/** @hidden */\nexport function getInputAccountAddress(input: Input) {\n  if (input.type === InputType.Coin) {\n    return input.owner.toString();\n  }\n\n  if (input.type === InputType.Message) {\n    return input.recipient.toString();\n  }\n","sourceCodeStart":99,"sourceCodeEnd":135,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/account/src/providers/transaction-summary/input.ts#L99-L135","documentation":"Thrown by `getInputContract()` (transaction-summary/input.ts) when the input at the given `inputIndex` exists but its `type` is not `InputType.Contract`. The function is used during transaction summary assembly to resolve a contract input referenced by an output; if the slot holds a Coin or Message instead, the type contract is violated and decoding would be unsafe.","triggerScenarios":"Transaction summary assembly where a receipt/output references `inputIndex` pointing at a non-contract input. Typically reached internally from `getTransactionSummary` / `getTransactionSummaryFromRequest` when correlating contract outputs to their inputs.","commonSituations":"A malformed or corrupted transaction where input/output indices are inconsistent; a manually-constructed transaction with a contract output referencing a coin input index; decoding a transaction built by an incompatible tool that ordered inputs differently.","solutions":["Ensure contract outputs reference the correct `inputIndex` that points to a contract-type input.","Do not reorder inputs after building outputs; rebuild the transaction request if input order changes.","Validate input/output index consistency before submitting."],"exampleFix":"// before (contract output points at a coin input slot)\nrequest.inputs = [coinInput];\nrequest.outputs = [{ type: OutputType.Contract, inputIndex: 0 }]; // wrong\n// after\nrequest.inputs = [contractInput, coinInput];\nrequest.outputs = [{ type: OutputType.Contract, inputIndex: 0 }]; // points at contract","handlingStrategy":"validation","validationCode":"import { InputType } from '@fuel-ts/transactions';\nfunction contractInputAt(inputs: any[], idx: number) {\n  const inp = inputs[idx];\n  return inp && inp.type === InputType.Contract ? inp : undefined;\n}","typeGuard":"function isInputContract(v: unknown): v is import('@fuel-ts/transactions').InputContract {\n  return typeof v === 'object' && v !== null && (v as any).type === InputType.Contract;\n}","tryCatchPattern":"null","preventionTips":["Keep input ordering stable once contract outputs reference inputIndex.","Rebuild the request rather than reordering inputs after outputs are set.","Validate that contract outputs point at contract-type inputs."],"tags":["transaction","summary","input-validation","decoding"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}