{"record":{"id":"19b7323844cd864c","repo":"affaan-m/ECC","slug":"an-install-config-path-is-required","errorCode":null,"errorMessage":"An install config path is required","messagePattern":"An install config path is required","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/lib/install/config.js","lineNumber":43,"sourceCode":"  // common case, e.g. `--list-profiles`) don't need it on the require path.\n  const Ajv = require('ajv');\n  const schema = readJson(CONFIG_SCHEMA_PATH, 'ecc-install-config.schema.json');\n  const ajv = new Ajv({ allErrors: true });\n  cachedValidator = ajv.compile(schema);\n  return cachedValidator;\n}\n\nfunction dedupeStrings(values) {\n  return [...new Set((Array.isArray(values) ? values : []).map(value => String(value).trim()).filter(Boolean))];\n}\n\nfunction formatValidationErrors(errors = []) {\n  return errors.map(error => `${error.instancePath || '/'} ${error.message}`).join('; ');\n}\n\nfunction resolveInstallConfigPath(configPath, options = {}) {\n  if (!configPath) {\n    throw new Error('An install config path is required');\n  }\n\n  const cwd = options.cwd || process.cwd();\n  return path.isAbsolute(configPath)\n    ? configPath\n    : path.normalize(path.join(cwd, configPath));\n}\n\nfunction findDefaultInstallConfigPath(options = {}) {\n  const cwd = options.cwd || process.cwd();\n  const candidatePath = path.join(cwd, DEFAULT_INSTALL_CONFIG);\n  return fs.existsSync(candidatePath) ? candidatePath : null;\n}\n\nfunction loadInstallConfig(configPath, options = {}) {\n  const resolvedPath = resolveInstallConfigPath(configPath, options);\n\n  if (!fs.existsSync(resolvedPath)) {","sourceCodeStart":25,"sourceCodeEnd":61,"githubUrl":"https://github.com/affaan-m/ECC/blob/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/lib/install/config.js#L25-L61","documentation":"resolveInstallConfigPath requires a non-empty configPath argument; it resolves relative paths against cwd (or options.cwd) and returns an absolute normalized path. Throwing on empty/undefined input fails fast instead of resolving a meaningless default path.","triggerScenarios":"Calling resolveInstallConfigPath() or resolveInstallConfigPath('') / (null) / (undefined) — including passing an empty string from a CLI flag with no value or an unset variable.","commonSituations":"A CLI invocation missing the --config flag, an environment variable that expands to empty string, or a script forwarding an unset config variable into the API.","solutions":["Pass the path to the install config, e.g. resolveInstallConfigPath('install-config.json').","Check the CLI invocation for a missing --config flag or an empty environment variable.","Add a guard at the call site that errors with a helpful message when the config path is unset.","If the path is relative, ensure the expected cwd (or options.cwd) contains the file."],"exampleFix":"// before\nconst p = resolveInstallConfigPath(process.env.CONFIG_PATH); // unset\n// after\nconst cfgPath = process.env.CONFIG_PATH || 'install-config.json';\nconst p = resolveInstallConfigPath(cfgPath);","handlingStrategy":"validation","validationCode":"if (!configPath || typeof configPath !== 'string') {\n  throw new Error('Provide a config path, e.g. --config install-config.json');\n}","typeGuard":"function hasConfigPath(v) { return typeof v === 'string' && v.trim().length > 0; }","tryCatchPattern":"try {\n  const p = resolveInstallConfigPath(configPath);\n} catch (error) {\n  if (error.message === 'An install config path is required') {\n    console.error('Pass --config <path> or set CONFIG_PATH');\n    process.exitCode = 1;\n    return;\n  }\n  throw error;\n}","preventionTips":["Always pass --config explicitly in scripts and CI","Guard environment variables that may expand to empty strings","Add CLI-level required-flag validation before calling the API","Use a default config path constant when the argument is optional by design"],"tags":["missing-argument","config","cli"],"backgroundTag":"missing-required-argument","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"}