FuelLabs/fuels-ts · error · FuelError
INVALID_INPUT_PARAMETERS
INVALID_INPUT_PARAMETERS
Error message
Invalid Typegen programType: ${programType}. Must be one of ${Object.values(ProgramTypeEnum)} What it means
AbiTypeGen.getAssembledFiles switches over ProgramTypeEnum to dispatch to the correct assembler (contracts/scripts/predicates). Any value outside CONTRACT/SCRIPT/PREDICATE reaches default and is rejected, because no assembler exists for it.
Source
Thrown at packages/abi-typegen/src/AbiTypeGen.ts:88
});
// Assemble list of files to be written to disk
this.files = this.getAssembledFiles({ programType });
}
private getAssembledFiles(params: { programType: ProgramTypeEnum }): IFile[] {
const { abis, outputDir, versions } = this;
const { programType } = params;
switch (programType) {
case ProgramTypeEnum.CONTRACT:
return assembleContracts({ abis, outputDir, versions });
case ProgramTypeEnum.SCRIPT:
return assembleScripts({ abis, outputDir, versions });
case ProgramTypeEnum.PREDICATE:
return assemblePredicates({ abis, outputDir, versions });
default:
throw new FuelError(
ErrorCode.INVALID_INPUT_PARAMETERS,
`Invalid Typegen programType: ${programType}. Must be one of ${Object.values(
ProgramTypeEnum
)}`
);
}
}
}
View on GitHub (pinned to b3f37c91ac)
Solutions
- Import ProgramTypeEnum and pass one of ProgramTypeEnum.CONTRACT, SCRIPT, or PREDICATE.
- Validate the supplied value against Object.values(ProgramTypeEnum) before constructing AbiTypeGen.
Example fix
// before
new AbiTypeGen({ programType: 'contract', ... });
// after
import { ProgramTypeEnum } from '@fuel-ts/abi-typegen';
new AbiTypeGen({ programType: ProgramTypeEnum.CONTRACT, ... }); Defensive patterns
Strategy: type-guard
Validate before calling
import { ProgramTypeEnum } from '@fuel-ts/abi-typegen';
function isProgramType(v: unknown): v is ProgramTypeEnum {
return Object.values(ProgramTypeEnum).includes(v as ProgramTypeEnum);
}
if (!isProgramType(programType)) throw new Error('invalid programType'); Type guard
import { ProgramTypeEnum } from '@fuel-ts/abi-typegen';
function isProgramType(v: unknown): v is ProgramTypeEnum {
return Object.values(ProgramTypeEnum).includes(v as ProgramTypeEnum);
} Prevention
- Always pass ProgramTypeEnum members, not raw strings.
- Validate programType at the boundary when it comes from user input.
When it happens
Trigger: Constructing AbiTypeGen (or invoking the typegen CLI/API) with a programType not in ProgramTypeEnum; passing a raw string instead of the enum; typo in the enum value.
Common situations: Calling runTypegen/AbiTypeGen programmatically with a hardcoded string; the enum value source changed across SDK versions; downstream code passing a custom program kind.
Related errors
- MISSING_REQUIRED_PARAMETER
- Contract not found!
- TYPE_NOT_SUPPORTED
- UNSUPPORTED_ENCODING_VERSION
- UNSUPPORTED_ENCODING_VERSION
AI-assisted analysis of FuelLabs/fuels-ts@b3f37c91ac (2026-08-12).
Data as JSON: /api/errors/5ea1ddeb43764836.
Report an issue: GitHub.