affaan-m/ECC · error

An install config path is required

Error message

An install config path is required

What it means

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.

Solutions

  1. Pass the path to the install config, e.g. resolveInstallConfigPath('install-config.json').
  2. Check the CLI invocation for a missing --config flag or an empty environment variable.
  3. Add a guard at the call site that errors with a helpful message when the config path is unset.
  4. If the path is relative, ensure the expected cwd (or options.cwd) contains the file.

Example fix

// before
const p = resolveInstallConfigPath(process.env.CONFIG_PATH); // unset
// after
const cfgPath = process.env.CONFIG_PATH || 'install-config.json';
const p = resolveInstallConfigPath(cfgPath);
Defensive patterns

Strategy: validation

Validate before calling

if (!configPath || typeof configPath !== 'string') {
  throw new Error('Provide a config path, e.g. --config install-config.json');
}

Type guard

function hasConfigPath(v) { return typeof v === 'string' && v.trim().length > 0; }

Try / catch

try {
  const p = resolveInstallConfigPath(configPath);
} catch (error) {
  if (error.message === 'An install config path is required') {
    console.error('Pass --config <path> or set CONFIG_PATH');
    process.exitCode = 1;
    return;
  }
  throw error;
}

Prevention

When it happens

Trigger: Calling resolveInstallConfigPath() or resolveInstallConfigPath('') / (null) / (undefined) — including passing an empty string from a CLI flag with no value or an unset variable.

Common situations: 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.

Understand the failure class

Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.

Related errors


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

Appendix: source

Thrown at scripts/lib/install/config.js:43

  // common case, e.g. `--list-profiles`) don't need it on the require path.
  const Ajv = require('ajv');
  const schema = readJson(CONFIG_SCHEMA_PATH, 'ecc-install-config.schema.json');
  const ajv = new Ajv({ allErrors: true });
  cachedValidator = ajv.compile(schema);
  return cachedValidator;
}

function dedupeStrings(values) {
  return [...new Set((Array.isArray(values) ? values : []).map(value => String(value).trim()).filter(Boolean))];
}

function formatValidationErrors(errors = []) {
  return errors.map(error => `${error.instancePath || '/'} ${error.message}`).join('; ');
}

function resolveInstallConfigPath(configPath, options = {}) {
  if (!configPath) {
    throw new Error('An install config path is required');
  }

  const cwd = options.cwd || process.cwd();
  return path.isAbsolute(configPath)
    ? configPath
    : path.normalize(path.join(cwd, configPath));
}

function findDefaultInstallConfigPath(options = {}) {
  const cwd = options.cwd || process.cwd();
  const candidatePath = path.join(cwd, DEFAULT_INSTALL_CONFIG);
  return fs.existsSync(candidatePath) ? candidatePath : null;
}

function loadInstallConfig(configPath, options = {}) {
  const resolvedPath = resolveInstallConfigPath(configPath, options);

  if (!fs.existsSync(resolvedPath)) {

View on GitHub (pinned to 8321021c54)