{"record":{"id":"045c86506bb5bc1a","repo":"FuelLabs/fuels-ts","slug":"type-id-not-found","errorCode":"TYPE_ID_NOT_FOUND","errorMessage":"Type ID not found: ${typeId}.","messagePattern":"Type ID not found: (.+?)\\.","errorType":"exception","errorClass":"FuelError","httpStatus":null,"severity":"error","filePath":"packages/abi-typegen/src/utils/findType.ts","lineNumber":11,"sourceCode":"import { ErrorCode, FuelError } from '@fuel-ts/errors';\n\nimport type { IType } from '../types/interfaces/IType';\n\nexport function findType(params: { types: IType[]; typeId: number }) {\n  const { types, typeId } = params;\n\n  const foundType = types.find(({ rawAbiType: { typeId: tid } }) => tid === typeId);\n\n  if (!foundType) {\n    throw new FuelError(ErrorCode.TYPE_ID_NOT_FOUND, `Type ID not found: ${typeId}.`);\n  }\n\n  // ensure type attributes is always parsed\n  foundType.parseComponentsAttributes({ types });\n\n  return foundType;\n}\n","sourceCodeStart":1,"sourceCodeEnd":19,"githubUrl":"https://github.com/FuelLabs/fuels-ts/blob/b3f37c91aca4aa9d5e4c0d3967f66237190826ea/packages/abi-typegen/src/utils/findType.ts#L1-L19","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"function assertAllTypeIdsPresent(types: { rawAbiType: { typeId: number } }[], neededIds: number[]) {\n  const have = new Set(types.map(t => t.rawAbiType.typeId));\n  const missing = neededIds.filter(id => !have.has(id));\n  if (missing.length) throw new Error('missing typeIds: ' + missing.join(', '));\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["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."],"tags":["typegen","type-id-not-found","abi-validation"],"backgroundTag":null,"analyzedSha":"b3f37c91aca4aa9d5e4c0d3967f66237190826ea","analyzedAt":"2026-08-12T20:30:56.448Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}