FuelLabs/fuels-ts · error · FuelError

INVALID_COMPONENT

INVALID_COMPONENT

Error message

The Vec type provided is missing or has a malformed 'buf' component.

What it means

findVectorBufferArgument locates the `buf` component of a Vec type and reads its first originalTypeArgument (the element type). If either the `buf` component is absent or its originalTypeArguments[0] is missing, the Vec cannot be decoded because its element type is unknown.

Source

Thrown at packages/abi-coder/src/utils/json-abi.ts:91

 */
export const findNonVoidInputs = (
  abi: JsonAbiOld,
  inputs: readonly JsonAbiArgument[]
): JsonAbiArgument[] => inputs.filter((input) => findTypeById(abi, input.type).type !== VOID_TYPE);

/**
 * Find the vector buffer argument in a list of components.
 *
 * @param components - the list of components to search
 * @returns the vector buffer argument
 */
export const findVectorBufferArgument = (
  components: readonly ResolvedAbiType[]
): JsonAbiArgument => {
  const bufferComponent = components.find((c) => c.name === 'buf');
  const bufferTypeArgument = bufferComponent?.originalTypeArguments?.[0];
  if (!bufferComponent || !bufferTypeArgument) {
    throw new FuelError(
      ErrorCode.INVALID_COMPONENT,
      `The Vec type provided is missing or has a malformed 'buf' component.`
    );
  }
  return bufferTypeArgument;
};

View on GitHub (pinned to b3f37c91ac)

Solutions

  1. Open the ABI and confirm Vec types have a component named `buf` with a non-empty originalTypeArguments array.
  2. Regenerate the ABI with the Sway compiler version matching the SDK.
  3. Validate Vec entries programmatically before constructing an Interface.

Example fix

// before (malformed)
{ "type": "Vec", "components": [ { "name": "buf", "type": "Vec", "typeArguments": [] } ] }

// after
{ "type": "Vec", "components": [ { "name": "buf", "type": "RawVec", "typeArguments": [ { "name": "T", "type": "u64", "typeArguments": [] } ] } ] }
Defensive patterns

Strategy: validation

Validate before calling

function validateVecComponents(abi: JsonAbi) {
  for (const t of abi.types) {
    if (t.type === 'Vec') {
      const buf = (t.components ?? []).find(c => c.name === 'buf');
      if (!buf || !buf.originalTypeArguments?.length) {
        throw new Error(`Vec typeId ${t.typeId} has missing/malformed buf component`);
      }
    }
  }
}

Prevention

When it happens

Trigger: ABI declares a Vec type whose components do not include a `buf` entry, or whose `buf` entry lacks originalTypeArguments. Typically a structurally malformed Vec entry produced by tooling or hand-editing.

Common situations: ABI exported from an older/newer compiler that shapes Vec differently; manually constructed Vec type without the buf wrapper; ABI corruption in transit.

Understand the failure class

Related errors


AI-assisted analysis of FuelLabs/fuels-ts@b3f37c91ac (2026-08-12). Data as JSON: /api/errors/17f2882f94b154f8. Report an issue: GitHub.