yamadashy/repomix · error · RepomixError

Config file not found at ${argConfigPath}

Error message

Config file not found at ${argConfigPath}

What it means

loadFileConfig throws this when an explicit --config path is given, the path is resolved against rootDir, and checkFileExists (fs.stat + isFile) finds no regular file there. The message echoes the argument as typed. Unlike the no-flag case (which silently falls back to local/global discovery and eventually defaults), an explicit --config is treated as the user's intentional choice, so a missing file is a hard error rather than a fallback.

Source

Thrown at src/config/configLoad.ts:103

export const loadFileConfig = async (
  rootDir: string,
  argConfigPath: string | null,
  options: { skipLocalConfig?: boolean; skipGlobalConfig?: boolean } = {},
  deps = {
    jitiImport: defaultJitiImport,
  },
): Promise<RepomixConfigFile> => {
  if (argConfigPath) {
    // Explicit --config flag is always respected (user's intentional choice)
    const fullPath = path.resolve(rootDir, argConfigPath);
    logger.trace('Loading local config from:', fullPath);

    const isLocalFileExists = await checkFileExists(fullPath);

    if (isLocalFileExists) {
      return await loadAndValidateConfig(fullPath, deps);
    }
    throw new RepomixError(`Config file not found at ${argConfigPath}`);
  }

  // Try to find a local config file using the priority order
  const localConfigPath = await findLocalConfigPath(rootDir);

  if (localConfigPath) {
    if (!options.skipLocalConfig) {
      return await loadAndValidateConfig(localConfigPath, deps);
    }
    // Log when config files are skipped for security (remote mode)
    logger.note(
      `Skipping config file found in remote repository for security: ${path.basename(localConfigPath)}\n` +
        'Use --remote-trust-config to trust and load it.',
    );
  }

  // Try to find a global config file using the priority order. skipGlobalConfig
  // (set for untrusted-agent contexts like --sandbox) skips it too: even the

View on GitHub (pinned to f465ad9093)

Solutions

  1. Verify the path exists and is a file: `ls -la <path>` or `test -f <path> && echo ok`.
  2. Use an absolute path with --config to avoid cwd/rootDir resolution surprises.
  3. Check the filename against supported names/extensions: repomix.config.{ts,mts,cts,js,mjs,cjs,json5,jsonc,json}.
  4. Fix scripts/CI to cd into the project root (or pass paths relative to it) before invoking repomix.

Example fix

# before
repomix --config ./configs/repomix.json   # file is actually repomix.config.json

# after
repomix --config "$PWD/configs/repomix.config.json"
Defensive patterns

Strategy: validation

Validate before calling

import fs from 'node:fs/promises';
import path from 'node:path';
const fullPath = path.resolve(rootDir, argConfigPath);
const st = await fs.stat(fullPath).catch(() => null);
if (!st?.isFile()) {
  throw new Error(`--config target not found or not a file: ${fullPath}`);
}

Try / catch

try {
  await runPack({ config: argConfigPath });
} catch (e) {
  if (e instanceof RepomixError && e.message.startsWith('Config file not found at')) {
    console.error(`Check the path: ${e.message}; resolved against project root.`);
  } else throw e;
}

Prevention

When it happens

Trigger: `repomix --config path/to/repomix.config.json` where the resolved path does not exist, is a directory instead of a file, or has a typo'd filename/extension. Also occurs when passing a relative path from the wrong working directory, since it's resolved against rootDir.

Common situations: Typo in the config filename or extension; passing a path relative to the wrong cwd in scripts/CI; file deleted or renamed after a version change; passing a directory path; Windows/POSIX path separator confusion in scripts.

Related errors


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