FuelLabs/fuels-ts · error · FuelError
TYPE_NOT_FOUND
TYPE_NOT_FOUND
Error message
Type with typeId '${typeId}' doesn't exist in the ABI. What it means
findTypeById searches the OLD-format ABI's types array (JsonAbiOld) for an entry whose typeId matches. A miss indicates a dangling type reference: some other ABI entry points at a typeId that has no corresponding definition, so type resolution cannot continue.
Source
Thrown at packages/abi-coder/src/utils/json-abi.ts:58
throw new FuelError(
ErrorCode.FUNCTION_NOT_FOUND,
`Function with name '${name}' doesn't exist in the ABI`
);
}
return fn;
};
/**
* Find a type by its typeId in the ABI.
*
* @param abi - the JsonAbi object
* @param typeId - the typeId of the type to find
* @returns the JsonAbi type object
*/
export const findTypeById = (abi: JsonAbiOld, typeId: number): JsonAbiType => {
const type = abi.types.find((t) => t.typeId === typeId);
if (!type) {
throw new FuelError(
ErrorCode.TYPE_NOT_FOUND,
`Type with typeId '${typeId}' doesn't exist in the ABI.`
);
}
return type;
};
/**
* Find all non-void inputs in a list of inputs.
* i.e. all inputs that are not of the type '()'.
*
* @param abi - the JsonAbi object
* @param inputs - the list of inputs to filter
* @returns the list of non-void inputs
*/
export const findNonVoidInputs = (
abi: JsonAbiOld,
inputs: readonly JsonAbiArgument[]View on GitHub (pinned to b3f37c91ac)
Solutions
- Inspect the ABI's types[] for the missing typeId noted in the error message.
- Regenerate the ABI from Sway source with forc to restore consistency.
- Validate that every typeId referenced across the ABI exists in types[] before loading.
Defensive patterns
Strategy: validation
Validate before calling
function validateTypeIds(abi: JsonAbiOld) {
const ids = new Set(abi.types.map(t => t.typeId));
const dangling: number[] = [];
const visit = (t: JsonAbiType) => {
for (const c of t.components ?? []) {
if (typeof c.typeId === 'number' && !ids.has(c.typeId)) dangling.push(c.typeId);
}
};
abi.types.forEach(visit);
if (dangling.length) throw new Error('dangling typeIds: ' + dangling.join(', '));
} Prevention
- Regenerate ABIs with forc to keep types[] internally consistent.
- Never delete entries from a JSON ABI without checking references.
- Validate typeId integrity before loading an externally-sourced ABI.
When it happens
Trigger: Loading a JsonAbiOld whose types[] is missing a typeId referenced by a function input/output or by another type's components/typeArguments; corrupt or partially-truncated ABI; mixing type fragments from different ABIs.
Common situations: ABI hand-edited and a type removed while still referenced; ABI produced by a tool that emitted typeId gaps; converting a new-format ABI to old-format incorrectly.
Related errors
AI-assisted analysis of FuelLabs/fuels-ts@b3f37c91ac (2026-08-12).
Data as JSON: /api/errors/7977cf176818f914.
Report an issue: GitHub.