FuelLabs/fuels-ts · error · FuelError

MISSING_REQUIRED_PARAMETER

MISSING_REQUIRED_PARAMETER

Error message

At least one parameter should be supplied: 'input' or 'filepaths'.

What it means

runTypegen requires at least one of the `input` (glob patterns) or `filepaths` (explicit list) parameters to supply ABI source files. If both are absent/empty the generator has no inputs to process and aborts before doing any filesystem work.

Source

Thrown at packages/abi-typegen/src/runTypegen.ts:48

  function log(...args: unknown[]) {
    if (!silent) {
      // eslint-disable-next-line no-console
      console.log(args.join(' '));
    }
  }

  /*
    Assembling files array and expanding globals if needed
  */
  let filepaths: string[] = [];

  if (!inputFilepaths?.length && inputs?.length) {
    filepaths = inputs.flatMap((i) => globSync(i, { cwd }));
  } else if (inputFilepaths?.length) {
    filepaths = inputFilepaths;
  } else {
    throw new FuelError(
      ErrorCode.MISSING_REQUIRED_PARAMETER,
      `At least one parameter should be supplied: 'input' or 'filepaths'.`
    );
  }

  /*
    Assembling file paths x contents
  */
  const abiFiles = filepaths.map((filepath) => {
    const contents = readFileSync(filepath, 'utf-8');
    const abi: IFile = {
      path: filepath,
      contents,
    };

    return abi;
  });

View on GitHub (pinned to b3f37c91ac)

Solutions

  1. Provide at least `input` as a non-empty array of glob patterns, or `filepaths` as explicit ABI paths.
  2. If invoking from a wrapper script, validate options before calling runTypegen.

Example fix

// before
runTypegen({ project: 'contracts', output: 'src' });

// after
runTypegen({ project: 'contracts', output: 'src', input: ['abis/*-abi.json'] });
Defensive patterns

Strategy: validation

Validate before calling

function assertTypegenInputs(opts: { input?: string[]; filepaths?: string[] }) {
  if (!opts.input?.length && !opts.filepaths?.length) {
    throw new Error("Provide 'input' globs or 'filepaths'");
  }
}

Prevention

When it happens

Trigger: Invoking runTypegen with neither inputs nor inputFilepaths; passing inputs as an empty array and no filepaths; parameter destructuring drops the field due to a typo.

Common situations: Programmatic typegen call missing the inputs option; CLI invocation with a misconfigured config file that yields empty inputs; refactoring that renames the option key.

Related errors


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