yamadashy/repomix · error · RepomixError

Unsupported config file format: ${filePath}

Error message

Unsupported config file format: ${filePath}

What it means

loadAndValidateConfig dispatches on the config file's extension. Executable extensions (.ts/.mts/.cts/.js/.mjs/.cjs) go through jiti; .json5/.jsonc/.json are parsed with JSON5; anything else hits the default case, which throws this RepomixError. In practice this means --config was pointed at a file whose extension repomix does not recognize (getFileExtension returns '' or an unsupported value), so repomix cannot know how to parse it.

Source

Thrown at src/config/configLoad.ts:200

        const defaultExport =
          imported && typeof imported === 'object' && 'default' in imported
            ? (imported as { default: unknown }).default
            : undefined;
        config = defaultExport && typeof defaultExport === 'object' ? defaultExport : imported;
        break;
      }

      case 'json5':
      case 'jsonc':
      case 'json': {
        // Use JSON5 for JSON/JSON5/JSONC files
        const fileContent = await fs.readFile(filePath, 'utf-8');
        config = JSON5.parse(fileContent);
        break;
      }

      default:
        throw new RepomixError(`Unsupported config file format: ${filePath}`);
    }

    return v.parse(repomixConfigFileSchema, config);
  } catch (error) {
    rethrowValidationErrorIfSchemaError(error, 'Invalid config schema');
    if (error instanceof SyntaxError) {
      throw new RepomixError(`Invalid syntax in config file ${filePath}: ${error.message}`);
    }
    if (error instanceof Error) {
      throw new RepomixError(`Error loading config from ${filePath}: ${error.message}`);
    }
    throw new RepomixError(`Error loading config from ${filePath}`);
  }
};

export const mergeConfigs = (
  cwd: string,
  fileConfig: RepomixConfigFile,

View on GitHub (pinned to f465ad9093)

Solutions

  1. Rename the config to a supported extension: repomix.config.json (or .json5/.jsonc/.js/.ts etc.).
  2. Convert YAML/TOML content to JSON (e.g. `yq -o=json config.yaml > repomix.config.json`).
  3. Remove extra suffixes (.bak, .template) from the filename before passing it via --config.
  4. Ensure the extension case is lowercase (`.json`, not `.JSON`), since matching is case-sensitive.

Example fix

# before
repomix --config repomix.yaml

# after
yq -o=json repomix.yaml > repomix.config.json
repomix --config repomix.config.json
Defensive patterns

Strategy: validation

Validate before calling

const SUPPORTED = /\.(ts|mts|cts|js|mjs|cjs|json5|jsonc|json)$/;
if (!SUPPORTED.test(configPath)) {
  throw new Error(`${configPath}: unsupported extension; use repomix.config.{json,json5,jsonc,js,ts,...}`);
}

Try / catch

try {
  await runPack({ config: argConfigPath });
} catch (e) {
  if (e instanceof RepomixError && e.message.startsWith('Unsupported config file format')) {
    console.error(`Rename/convert the config to a supported format: ${e.message}`);
  } else throw e;
}

Prevention

When it happens

Trigger: Passing `--config file.yaml`, `--config config.toml`, `--config repomix.conf`, or any path lacking one of the supported extensions (.ts .mts .cts .js .mjs .cjs .json5 .jsonc .json) to repomix. The getFileExtension regex matches exactly those endings; e.g. a `.JSON` (uppercase) or `.yml` file lands in the default case.

Common situations: Porting a config from another tool (TOML/YAML); uppercase or double extensions like config.json.bak; creating a config without an extension; copying a snippet into `repomix.config` with no suffix.

Related errors


AI-assisted analysis of yamadashy/repomix@f465ad9093 (2026-08-29). Data as JSON: /api/errors/fb778e48a675de05. Report an issue: GitHub.