FuelLabs/fuels-ts · error · FuelError

CODER_NOT_FOUND

CODER_NOT_FOUND

Error message

Coder not found: ${JSON.stringify(resolvedAbiType)}.

What it means

The terminal fallthrough of getCoderV1: every recognized Sway type shape (array, vec, enum, option, tuple, primitive, struct) has been tested via regex/component matching, and none matched. The full resolvedAbiType is JSON-stringified into the message so the unsupported shape is visible.

Source

Thrown at packages/abi-coder/src/encoding/strategies/getCoderV1.ts:155

  }

  const enumMatch = enumRegEx.test(resolvedAbiType.type);
  if (enumMatch && coderName) {
    const coders = getCoders(components, { getCoder });
    const isOptionEnum = resolvedAbiType.type === OPTION_CODER_TYPE;
    if (isOptionEnum) {
      return new OptionCoder(coderName, coders);
    }
    return new EnumCoder(coderName, coders);
  }

  const tupleMatch = tupleRegEx.exec(resolvedAbiType.type)?.groups;
  if (tupleMatch) {
    const coders = components.map((component) => getCoder(component, { encoding: ENCODING_V1 }));
    return new TupleCoder(coders as Coder[]);
  }

  throw new FuelError(
    ErrorCode.CODER_NOT_FOUND,
    `Coder not found: ${JSON.stringify(resolvedAbiType)}.`
  );
};

View on GitHub (pinned to b3f37c91ac)

Solutions

  1. Read the JSON-stringified resolvedAbiType in the error to identify the unrecognized `type` string.
  2. Upgrade @fuel-ts/abi-coder (and the wider SDK) to a version that supports your Sway compiler output.
  3. Simplify the offending Sway type to one the SDK recognizes and rebuild the ABI.
  4. If you control the ABI, correct the malformed `type` field to a valid Sway type expression.
Defensive patterns

Strategy: validation

Validate before calling

function assertAllTypesResolved(abi: JsonAbi) {
  // walk every type through getCoder in a try/catch and collect failures
  const unresolved: string[] = [];
  for (const t of abi.types) {
    try { getCoder(new ResolvedAbiType(abi, t)); }
    catch { unresolved.push(`${t.typeId}: ${t.type}`); }
  }
  if (unresolved.length) throw new Error('unsupported types: ' + unresolved.join(', '));
}

Prevention

When it happens

Trigger: An ABI type whose `type` string is not recognized by any of the regex matchers (arrayRegEx, tupleRegEx, VEC_CODER_TYPE, enum/option shapes) and is not a registered primitive. Typical with custom or newly introduced Sway type forms.

Common situations: Using a Sway compiler version newer than the SDK supports; ABI referencing a generic or advanced type the coder does not yet handle; ABI hand-crafted with a type string that does not match Sway grammar.

Related errors


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