{"record":{"id":"4b57a6925920738f","repo":"FuelLabs/fuels-ts","slug":"invalid-component","errorCode":"INVALID_COMPONENT","errorMessage":"The provided ABI type is too long: ${jsonABIType.type}.","messagePattern":"The provided ABI type is too long: (.+?)\\.","errorType":"error_code","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/abi-coder/src/ResolvedAbiType.ts","lineNumber":22,"sourceCode":"import { arrayRegEx, enumRegEx, genericRegEx, stringRegEx, structRegEx } from './utils/constants';\nimport { findTypeById } from './utils/json-abi';\n\nexport class ResolvedAbiType {\n  readonly abi: JsonAbiOld;\n  name: string;\n  readonly type: string;\n  readonly originalTypeArguments: readonly JsonAbiArgument[] | null;\n  readonly components: readonly ResolvedAbiType[] | null;\n\n  constructor(abi: JsonAbiOld, argument: JsonAbiArgument) {\n    this.abi = abi;\n\n    this.name = argument.name;\n\n    const jsonABIType = findTypeById(abi, argument.type);\n\n    if (jsonABIType.type.length > 256) {\n      throw new FuelError(\n        ErrorCode.INVALID_COMPONENT,\n        `The provided ABI type is too long: ${jsonABIType.type}.`\n      );\n    }\n\n    this.type = jsonABIType.type;\n    this.originalTypeArguments = argument.typeArguments;\n    this.components = ResolvedAbiType.getResolvedGenericComponents(\n      abi,\n      argument,\n      jsonABIType.components,\n      jsonABIType.typeParameters ??\n        ResolvedAbiType.getImplicitGenericTypeParameters(abi, jsonABIType.components)\n    );\n  }\n\n  private static getResolvedGenericComponents(\n    abi: JsonAbiOld,","sourceCodeStart":4,"sourceCodeEnd":40,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/abi-coder/src/ResolvedAbiType.ts#L4-L40","documentation":"Thrown by the `ResolvedAbiType` constructor (code `INVALID_COMPONENT`) when a type string in the ABI exceeds 256 characters. This is a sanity guard against pathological/malformed ABI type strings, since a real Sway type longer than 256 chars almost always indicates corruption or a bad hand-edited ABI.","triggerScenarios":"Loading a hand-crafted or corrupted ABI where a type's `type` field is a giant string; a codegen bug producing runaway recursive type strings; binary corruption of the JSON ABI file.","commonSituations":"Manually editing a JSON ABI and accidentally duplicating/pasting content into a type field; feeding a non-Sway ABI to the coder; truncation/encoding artifacts producing a long garbage string.","solutions":["Regenerate the ABI by recompiling the Sway contract (`forc build`) — never hand-edit ABI type strings.","Inspect the offending type in the ABI JSON (the message prints it) and locate the corruption.","Ensure the file you pass as the ABI is the actual Sway-compiled JSON ABI, not a template or fragment."],"exampleFix":"// before: hand-edited abi.json with a corrupted type\n{ \"type\": \"u64u64u64....(300 chars)....\" }\n// after: regenerate with forc and load the clean ABI\n$ forc build\nconst abi = loadAbi('./out/project-abi.json');","handlingStrategy":"validation","validationCode":"// reject pathological ABIs before constructing coders\nconst MAX_TYPE_LEN = 256;\nconst offenders = abi.types.filter((t) => t.type.length > MAX_TYPE_LEN);\nif (offenders.length) {\n  throw new Error(`ABI has ${offenders.length} type(s) longer than ${MAX_TYPE_LEN} chars`);\n}","typeGuard":null,"tryCatchPattern":"try {\n  const resolved = new ResolvedAbiType(abi, arg);\n} catch (e) {\n  if (e.code === 'INVALID_COMPONENT' && /too long/.test(e.message)) {\n    // ABI is corrupted — regenerate via `forc build`\n  }\n  throw e;\n}","preventionTips":["Never hand-edit ABI type strings; always regenerate with `forc build`.","Validate the ABI JSON shape before passing it to the coder.","Treat this error as a corruption signal and replace the ABI file."],"tags":["abi-coder","abi-validation","corrupted-abi"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}