FuelLabs/fuels-ts · error · FuelError
TYPE_ID_NOT_FOUND
TYPE_ID_NOT_FOUND
Error message
Type ID not found: ${typeId}. What it means
findType (typegen side) looks up a previously-parsed IType by typeId within the in-memory types list. A miss means the typegen parsed a set of types but a referenced typeId was never materialized, so cross-type references cannot be resolved.
Source
Thrown at packages/abi-typegen/src/utils/findType.ts:11
import { ErrorCode, FuelError } from '@fuel-ts/errors';
import type { IType } from '../types/interfaces/IType';
export function findType(params: { types: IType[]; typeId: number }) {
const { types, typeId } = params;
const foundType = types.find(({ rawAbiType: { typeId: tid } }) => tid === typeId);
if (!foundType) {
throw new FuelError(ErrorCode.TYPE_ID_NOT_FOUND, `Type ID not found: ${typeId}.`);
}
// ensure type attributes is always parsed
foundType.parseComponentsAttributes({ types });
return foundType;
}
View on GitHub (pinned to b3f37c91ac)
Solutions
- Check the missing typeId (printed in the error) exists in the ABI's types[].
- Regenerate the ABI from Sway source with forc.
- Ensure all ABI fragments are loaded together so type references resolve.
Defensive patterns
Strategy: validation
Validate before calling
function assertAllTypeIdsPresent(types: { rawAbiType: { typeId: number } }[], neededIds: number[]) {
const have = new Set(types.map(t => t.rawAbiType.typeId));
const missing = neededIds.filter(id => !have.has(id));
if (missing.length) throw new Error('missing typeIds: ' + missing.join(', '));
} Prevention
- Load all ABI fragments together so cross-type references resolve.
- Regenerate the ABI with forc to eliminate typeId gaps.
- Validate typeId integrity before invoking typegen.
When it happens
Trigger: A JSON ABI whose types[] does not include an entry for a typeId referenced by another type's components/typeArguments; parsing only a subset of types; corrupted ABI with gaps.
Common situations: ABI hand-edited to remove a type; ABI split across files and not all loaded; Sway compiler version that emits typeId gaps the typegen did not anticipate.
Related errors
AI-assisted analysis of FuelLabs/fuels-ts@b3f37c91ac (2026-08-12).
Data as JSON: /api/errors/045c86506bb5bc1a.
Report an issue: GitHub.