{"record":{"id":"0531694a558a8a72","repo":"yamadashy/repomix","slug":"unsupported-output-file-path-style-filepathstyl","errorCode":null,"errorMessage":"Unsupported output file path style: ${filePathStyle}","messagePattern":"Unsupported output file path style: (.+?)","errorType":"validation","errorClass":"RepomixError","httpStatus":null,"severity":"error","filePath":"src/core/packager/rootDisplayPath.ts","lineNumber":96,"sourceCode":"\nexport const buildFileDisplayPath = ({\n  rootDir,\n  filePath,\n  cwd,\n  filePathStyle,\n  rootLabel,\n}: BuildFileDisplayPathParams): string => {\n  switch (filePathStyle) {\n    case 'cwd-relative': {\n      const absolutePath = path.resolve(rootDir, filePath);\n      return toDisplayPath(path.relative(path.resolve(cwd), absolutePath)) || '.';\n    }\n    case 'target-relative':\n      return rootLabel ? joinDisplayPath(rootLabel, filePath) : toDisplayPath(filePath);\n    default:\n      // Exhaustive: adding a new style to repomixOutputFilePathStyleSchema must\n      // be handled here explicitly rather than silently falling through.\n      throw new RepomixError(`Unsupported output file path style: ${filePathStyle}`);\n  }\n};\n\n/**\n * Whether a file path style renders files with per-root display labels (and a\n * per-root tree). Centralizing this keeps the \"which styles use root labels\"\n * decision in one exhaustive place, so adding a new style surfaces here (and\n * errors if left unhandled) instead of silently defaulting in scattered checks.\n */\nexport const usesRootLabels = (filePathStyle: RepomixOutputFilePathStyle): boolean => {\n  switch (filePathStyle) {\n    case 'target-relative':\n      return true;\n    case 'cwd-relative':\n      return false;\n    default:\n      throw new RepomixError(`Unsupported output file path style: ${filePathStyle}`);\n  }","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/yamadashy/repomix/blob/f465ad909315a22120636baf03fa5e28701a50cb/src/core/packager/rootDisplayPath.ts#L78-L114","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Set output.filePathStyle to 'cwd-relative' or 'target-relative' in config.","Load config through the official validation entry point (parseRepomixConfig / CLI) so the schema rejects bad values early.","Upgrade repomix if the config uses a style added in a newer version."],"exampleFix":"// before (repomix.json)\n\"filePathStyle\": \"repo-relative\"\n// after\n\"filePathStyle\": \"cwd-relative\"","handlingStrategy":"type-guard","validationCode":"const VALID_STYLES = ['cwd-relative', 'target-relative'] as const;\nconst isStyle = (s: unknown): s is typeof VALID_STYLES[number] =>\n  VALID_STYLES.includes(s as never);\nif (!isStyle(config.output.filePathStyle)) throw new Error('Invalid filePathStyle');","typeGuard":"const isValidFilePathStyle = (v: unknown): v is 'cwd-relative' | 'target-relative' =>\n  v === 'cwd-relative' || v === 'target-relative';","tryCatchPattern":"try {\n  await pack(config);\n} catch (e) {\n  if (e instanceof RepomixError && e.message.startsWith('Unsupported output file path style')) {\n    console.error('Use filePathStyle: cwd-relative | target-relative');\n  } else throw e;\n}","preventionTips":["Load config through the official schema-validating parser only.","Upgrade repomix when consuming configs from newer versions.","Use the TypeScript union type instead of raw strings in programmatic use.","Never hand-edit enum-like config values without checking the schema."],"tags":["config","schema-validation","exhaustiveness"],"backgroundTag":"invalid-enum-value","analyzedSha":"f465ad909315a22120636baf03fa5e28701a50cb","analyzedAt":"2026-08-29T01:27:42.024Z","schemaVersion":2},"datasetVersion":"2026-08-29T02:17:18.158Z"}