yamadashy/repomix · error · RepomixConfigValidationError

${message} ${errorText} Please check the config file a

Error message

${message}

  ${errorText}

  Please check the config file and try again.

What it means

rethrowValidationErrorIfSchemaError converts a Zod schema validation failure of the config file into a RepomixConfigValidationError whose message lists each issue (with its config path in brackets), the offending values, and a hint to check the config file. It exists so users get a readable, actionable message instead of a raw Zod error.

Source

Thrown at src/shared/errorHandle.ts:173

    .map((issue) => {
      const segments = Array.isArray(issue.path)
        ? (issue.path as unknown[])
            .map((segment) => {
              // Zod: path segments are primitives. Valibot: { key } objects.
              if (segment && typeof segment === 'object') {
                if ('key' in segment) return String((segment as { key: unknown }).key);
                return '';
              }
              return String(segment);
            })
            .filter((segment) => segment !== '')
        : [];
      // Omit the bracketed path entirely when there are no usable segments, so
      // a root-level / path-less issue reads as `message` instead of `[] message`.
      return segments.length === 0 ? issue.message : `[${segments.join('.')}] ${issue.message}`;
    })
    .join('\n  ');
  throw new RepomixConfigValidationError(
    `${message}\n\n  ${errorText}\n\n  Please check the config file and try again.`,
  );
};

View on GitHub (pinned to f465ad9093)

Solutions

  1. Read the bracketed paths and per-issue messages in the error; fix each listed field's type/value
  2. Validate your JSON syntax (no trailing commas/comments in .json) with `node -e "JSON.parse(require('fs').readFileSync('repomix.config.json'))"`
  3. Regenerate a known-good config with `repomix --init` and merge your settings in
  4. Compare against the current config schema docs for your repomix version

Example fix

// before (repomix.config.json)
{ "include": "src/**/*.ts", "output": { "style": "markdown2" } }
// after
{ "include": ["src/**/*.ts"], "output": { "style": "markdown" } }
Defensive patterns

Strategy: validation

Validate before calling

import fs from 'node:fs';
try { JSON.parse(fs.readFileSync('repomix.config.json', 'utf8')); }
catch (e) { throw new Error(`Config is not valid JSON: ${e.message}`); }
// then sanity-check known fields' types before running

Type guard

const isConfigArray = (v) => v === undefined || Array.isArray(v);
const isValidStyle = (v) => ['xml','markdown','json','plain'].includes(v);

Try / catch

import { RepomixConfigValidationError } from 'repomix';
try {
  await runRepomix(configFile);
} catch (e) {
  if (e instanceof RepomixConfigValidationError) {
    console.error(e.message); // lists each bad field; fix and retry
  } else throw e;
}

Prevention

When it happens

Trigger: Calling repomix (CLI or library) with a repomix.config.json / .json5 / .yaml whose fields violate the config schema: wrong types (e.g. `"include": "string"` instead of array), unknown enum values (bad `style`), out-of-range numbers (e.g. negative or too-large `topFilesLength`), or malformed JSON syntax.

Common situations: Hand-editing the config and quoting values incorrectly; migrating config from older repomix versions where option names/types changed; IDE autocomplete inserting wrong types; trailing commas or comments in plain .json.

Understand the failure class

Background: Schema validation failed / invalid input schema: payload rejected because its shape doesn't match the expected schema — this error's family across 28 libraries.

Related errors


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