affaan-m/ECC · error · Error

Invalid : expected a single cache path segment

Error message

Invalid ${flag}: expected a single cache path segment

What it means

validateCacheSegment throws when a CLI-provided cache path segment (--codex-home components: --marketplace, --plugin, --version) is empty, contains NUL, '..', '/', '\', or is absolute on either POSIX or Windows. It prevents path traversal outside the plugin cache; the faulting input is the value passed to `flag`.

Solutions

  1. Pass a simple single-segment name, e.g. --plugin ecc, --version 2.2.1.
  2. Remove any slashes, '..' or absolute paths from the value.
  3. If a nested path is needed, use --plugin-dir instead, which accepts full paths.
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at scripts/codex/check-plugin-cache.js:41 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16). Data as JSON: /api/errors/10f19e234ffd0558. Report an issue: GitHub.

Appendix: source

Thrown at scripts/codex/check-plugin-cache.js:41

    '  --marketplace <name> Marketplace cache name (default: ecc)',
    '  --plugin <name>      Plugin cache name (default: ecc)',
    '  --version <version>  Plugin version (default: package.json version)',
    '  --help              Show this help text',
  ].join('\n'));
}

function validateCacheSegment(flag, value) {
  if (
    typeof value !== 'string' ||
    value.trim() === '' ||
    value.includes('\0') ||
    value.includes('..') ||
    value.includes('/') ||
    value.includes('\\') ||
    path.isAbsolute(value) ||
    path.win32.isAbsolute(value)
  ) {
    throw new Error(`Invalid ${flag}: expected a single cache path segment`);
  }
  return value;
}

function parseArgs(argv) {
  const defaults = {
    marketplace: 'ecc',
    plugin: 'ecc',
    version: PACKAGE_JSON.version,
    codexHome: process.env.CODEX_HOME || path.join(os.homedir(), '.codex'),
    pluginDir: null,
  };
  const optionKeys = {
    '--codex-home': 'codexHome',
    '--plugin-dir': 'pluginDir',
    '--marketplace': 'marketplace',
    '--plugin': 'plugin',
    '--version': 'version',

View on GitHub (pinned to 8321021c54)