{"record":{"id":"10f19e234ffd0558","repo":"affaan-m/ECC","slug":"invalid-flag-expected-a-single-cache-path-segm","errorCode":null,"errorMessage":"Invalid ${flag}: expected a single cache path segment","messagePattern":"Invalid (.+?): expected a single cache path segment","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/codex/check-plugin-cache.js","lineNumber":41,"sourceCode":"    '  --marketplace <name> Marketplace cache name (default: ecc)',\n    '  --plugin <name>      Plugin cache name (default: ecc)',\n    '  --version <version>  Plugin version (default: package.json version)',\n    '  --help              Show this help text',\n  ].join('\\n'));\n}\n\nfunction validateCacheSegment(flag, value) {\n  if (\n    typeof value !== 'string' ||\n    value.trim() === '' ||\n    value.includes('\\0') ||\n    value.includes('..') ||\n    value.includes('/') ||\n    value.includes('\\\\') ||\n    path.isAbsolute(value) ||\n    path.win32.isAbsolute(value)\n  ) {\n    throw new Error(`Invalid ${flag}: expected a single cache path segment`);\n  }\n  return value;\n}\n\nfunction parseArgs(argv) {\n  const defaults = {\n    marketplace: 'ecc',\n    plugin: 'ecc',\n    version: PACKAGE_JSON.version,\n    codexHome: process.env.CODEX_HOME || path.join(os.homedir(), '.codex'),\n    pluginDir: null,\n  };\n  const optionKeys = {\n    '--codex-home': 'codexHome',\n    '--plugin-dir': 'pluginDir',\n    '--marketplace': 'marketplace',\n    '--plugin': 'plugin',\n    '--version': 'version',","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/codex/check-plugin-cache.js#L23-L59","documentation":"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`.","triggerScenarios":"Thrown at scripts/codex/check-plugin-cache.js:41 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass a simple single-segment name, e.g. --plugin ecc, --version 2.2.1.","Remove any slashes, '..' or absolute paths from the value.","If a nested path is needed, use --plugin-dir instead, which accepts full paths."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}