FuelLabs/fuels-ts · info · FuelError

PARSE_FAILED

PARSE_FAILED

Error message

Unable to find package.json at ${inlinePackageJsonPath} or ${relativeBinPackageJsonPath}

What it means

Declared in getPackageVersion() (packages/create-fuels/src/lib/getPackageVersion.ts:29) when neither the inline package.json path (for PNPM resolution) nor the relative bin package.json path (for Bun resolution) exists on disk. IMPORTANT: this throw lives inside a try block (line 22) whose catch (line 37) silently falls back to versions.FUELS. Callers therefore never observe this error — they always receive a version string. It is documented here for completeness.

Source

Thrown at packages/create-fuels/src/lib/getPackageVersion.ts:29

 */
export const getPackageVersion = (args: string[]): string => {
  const [, execPath] = args;

  const basePath = dirname(execPath);
  // PNPM resolves to `node_modules/create-fuels/create-fuels.js`
  const inlinePackageJsonPath = join(basePath, 'package.json');
  // Bun resolves to `node_modules/.bin/create-fuels`
  const relativeBinPackageJsonPath = join(basePath, '..', 'create-fuels', 'package.json');

  let version: string;
  try {
    let path;
    if (existsSync(inlinePackageJsonPath)) {
      path = inlinePackageJsonPath;
    } else if (existsSync(relativeBinPackageJsonPath)) {
      path = relativeBinPackageJsonPath;
    } else {
      throw new FuelError(
        FuelError.CODES.PARSE_FAILED,
        `Unable to find package.json at ${inlinePackageJsonPath} or ${relativeBinPackageJsonPath}`
      );
    }

    const packageJson = readFileSync(path, 'utf8');
    version = JSON.parse(packageJson).version;
  } catch (error) {
    version = versions.FUELS;
  }

  return version;
};

View on GitHub (pinned to b3f37c91ac)

Solutions

  1. This error is handled internally — no action needed. The function falls back to versions.FUELS.
  2. If the fallback version is incorrect, verify the create-fuels package is installed properly: npm ls create-fuels or check node_modules.
  3. Reinstall the package with the intended package manager to ensure correct node_modules layout.
Defensive patterns

Strategy: fallback

Prevention

When it happens

Trigger: Running the create-fuels CLI in an environment where the package.json is not discoverable at either the expected PNPM path (node_modules/create-fuels/package.json) or Bun path (node_modules/.bin/../create-fuels/package.json). The error is caught and the function returns versions.FUELS instead.

Common situations: Running create-fuels via an unconventional package manager or resolution strategy; running from a global install where node_modules layout differs; symlinked or monorepo setups that relocate the package.json; Bun vs PNPM vs Yarn PPR resolution differences.

Related errors


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