yamadashy/repomix · error · RepomixError

Unsupported output file path style: ${filePathStyle}

Error message

Unsupported output file path style: ${filePathStyle}

What it means

buildFileDisplayPath switches over the configured output file path style and its `default` branch throws this exhaustive-check RepomixError for any style not in the expected union. At runtime this means the filePathStyle value reached the packager without schema validation, i.e. an invalid or future-unknown style.

Source

Thrown at src/core/packager/rootDisplayPath.ts:96

export const buildFileDisplayPath = ({
  rootDir,
  filePath,
  cwd,
  filePathStyle,
  rootLabel,
}: BuildFileDisplayPathParams): string => {
  switch (filePathStyle) {
    case 'cwd-relative': {
      const absolutePath = path.resolve(rootDir, filePath);
      return toDisplayPath(path.relative(path.resolve(cwd), absolutePath)) || '.';
    }
    case 'target-relative':
      return rootLabel ? joinDisplayPath(rootLabel, filePath) : toDisplayPath(filePath);
    default:
      // Exhaustive: adding a new style to repomixOutputFilePathStyleSchema must
      // be handled here explicitly rather than silently falling through.
      throw new RepomixError(`Unsupported output file path style: ${filePathStyle}`);
  }
};

/**
 * Whether a file path style renders files with per-root display labels (and a
 * per-root tree). Centralizing this keeps the "which styles use root labels"
 * decision in one exhaustive place, so adding a new style surfaces here (and
 * errors if left unhandled) instead of silently defaulting in scattered checks.
 */
export const usesRootLabels = (filePathStyle: RepomixOutputFilePathStyle): boolean => {
  switch (filePathStyle) {
    case 'target-relative':
      return true;
    case 'cwd-relative':
      return false;
    default:
      throw new RepomixError(`Unsupported output file path style: ${filePathStyle}`);
  }

View on GitHub (pinned to f465ad9093)

Solutions

  1. Set output.filePathStyle to 'cwd-relative' or 'target-relative' in config.
  2. Load config through the official validation entry point (parseRepomixConfig / CLI) so the schema rejects bad values early.
  3. Upgrade repomix if the config uses a style added in a newer version.

Example fix

// before (repomix.json)
"filePathStyle": "repo-relative"
// after
"filePathStyle": "cwd-relative"
Defensive patterns

Strategy: type-guard

Validate before calling

const VALID_STYLES = ['cwd-relative', 'target-relative'] as const;
const isStyle = (s: unknown): s is typeof VALID_STYLES[number] =>
  VALID_STYLES.includes(s as never);
if (!isStyle(config.output.filePathStyle)) throw new Error('Invalid filePathStyle');

Type guard

const isValidFilePathStyle = (v: unknown): v is 'cwd-relative' | 'target-relative' =>
  v === 'cwd-relative' || v === 'target-relative';

Try / catch

try {
  await pack(config);
} catch (e) {
  if (e instanceof RepomixError && e.message.startsWith('Unsupported output file path style')) {
    console.error('Use filePathStyle: cwd-relative | target-relative');
  } else throw e;
}

Prevention

When it happens

Trigger: Calling buildFileDisplayPath with a filePathStyle outside the repomixOutputFilePathStyleSchema union ('cwd-relative' | 'target-relative') — e.g. a hand-built config object bypassing validation, or a config file from a newer repomix version introducing a new style read by an older version.

Common situations: Typo in a manually written repomix.json field; using an npm-installed older repomix against a config generated for a newer version; programmatic API misuse passing a raw string instead of a validated enum.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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