{"record":{"id":"4850adade057477f","repo":"FuelLabs/fuels-ts","slug":"invalid-component-4850ad","errorCode":"INVALID_COMPONENT","errorMessage":"The provided Array type is missing an item of 'component'.","messagePattern":"The provided Array type is missing an item of 'component'\\.","errorType":"exception","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/abi-coder/src/encoding/strategies/getCoderV1.ts","lineNumber":112,"sourceCode":"  const stringMatch = stringRegEx.exec(resolvedAbiType.type)?.groups;\n  if (stringMatch) {\n    const length = parseInt(stringMatch.length, 10);\n\n    return new StringCoder(length);\n  }\n\n  // ABI types underneath MUST have components by definition\n\n  // eslint-disable-next-line @typescript-eslint/no-non-null-assertion\n  const components = resolvedAbiType.components!;\n\n  const arrayMatch = arrayRegEx.exec(resolvedAbiType.type)?.groups;\n\n  if (arrayMatch) {\n    const length = parseInt(arrayMatch.length, 10);\n    const arg = components[0];\n    if (!arg) {\n      throw new FuelError(\n        ErrorCode.INVALID_COMPONENT,\n        `The provided Array type is missing an item of 'component'.`\n      );\n    }\n\n    const arrayElementCoder = getCoder(arg);\n    return new ArrayCoder(arrayElementCoder as Coder, length);\n  }\n\n  if (resolvedAbiType.type === VEC_CODER_TYPE) {\n    const arg = findVectorBufferArgument(components);\n    const argType = new ResolvedAbiType(resolvedAbiType.abi, arg);\n\n    const itemCoder = getCoder(argType, { encoding: ENCODING_V1 });\n    return new VecCoder(itemCoder as Coder);\n  }\n\n  // component name","sourceCodeStart":94,"sourceCodeEnd":130,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/abi-coder/src/encoding/strategies/getCoderV1.ts#L94-L130","documentation":"Inside getCoderV1, an ABI type whose `type` field matches the array regex must supply at least one component (the element type). When components[0] is undefined the function cannot construct an ArrayCoder and throws INVALID_COMPONENT. This catches malformed array declarations in the JSON ABI before they reach the element coder.","triggerScenarios":"Loading a hand-edited or generated JSON ABI where an array-typed entry (e.g. type matching `[...;N]`) has an empty or missing `components` array; ABI produced by a buggy/old compiler; ABI file truncated during serialization.","commonSituations":"Editing an ABI JSON to add an array type but forgetting the components field; merging ABI fragments incorrectly; Sway compiler version that emits a different components shape than expected.","solutions":["Open the ABI JSON and confirm every array-typed entry has a non-empty components array with a valid element type.","Regenerate the ABI from the Sway source with `forc build` rather than editing by hand.","Validate the ABI against the expected schema before passing it to the coder/Interface."],"exampleFix":"// before (broken ABI fragment)\n{ \"type\": \"[u64; 3]\", \"components\": [], \"typeId\": 5 }\n\n// after\n{ \"type\": \"[u64; 3]\", \"components\": [ { \"name\": \"__array_element\", \"type\": \"u64\", \"typeArguments\": [] } ], \"typeId\": 5 }","handlingStrategy":"validation","validationCode":"function validateArrayComponents(abi: JsonAbi) {\n  for (const t of abi.types) {\n    if (/\\[/.test(t.type) && (!t.components || t.components.length === 0)) {\n      throw new Error(`array type ${t.typeId} (${t.type}) missing components`);\n    }\n  }\n}","typeGuard":null,"tryCatchPattern":"try { getCoder(resolvedAbiType); } catch (e) {\n  if (e instanceof FuelError && e.code === ErrorCode.INVALID_COMPONENT) { /* report bad ABI */ }\n  throw e;\n}","preventionTips":["Regenerate ABIs from Sway with forc rather than editing by hand.","Run an ABI shape validation pass before constructing an Interface.","Treat any array-typed ABI entry with empty components as a corrupt ABI."],"tags":["abi-coder","invalid-component","array","abi-validation"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}