affaan-m/ECC · error · Error

An install config path is required

Error message

An install config path is required

What it means

Thrown by resolveInstallConfigPath in scripts/lib/install/config.js when configPath is falsy. The resolver does not fall back to a default — that is the caller's job (findDefaultInstallConfigPath returns the candidate path or null). Any caller that forwards an optional --config flag straight into loadInstallConfig without first resolving a default will hit this.

Source

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

  }

  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 01e15490f0)

Solutions

  1. Before calling loadInstallConfig, resolve the path: const cfg = configPath || findDefaultInstallConfigPath({ cwd }); if (!cfg) throw ...
  2. Make --config required in your CLI when no default exists.
  3. Pass a non-empty string (absolute or relative).

Example fix

// before
const config = loadInstallConfig(options.config);

// after
const configPath = options.config || findDefaultInstallConfigPath({ cwd: process.cwd() });
if (!configPath) {
  throw new Error('No install config specified and no ecc-install.json found in cwd');
}
const config = loadInstallConfig(configPath, { cwd: process.cwd() });
Defensive patterns

Strategy: validation

Validate before calling

function requireConfigPath(configPath, options = {}) {
  return configPath || findDefaultInstallConfigPath(options);
}
const p = requireConfigPath(options.config, { cwd: process.cwd() });
if (!p) {
  throw new Error('No install config specified and no ecc-install.json found in cwd');
}

Type guard

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

Prevention

When it happens

Trigger: Calling loadInstallConfig(null) or loadInstallConfig('') without first calling findDefaultInstallConfigPath to discover an ecc-install.json in cwd.

Common situations: A CLI that made --config optional but forwards undefined; a wrapper script that reads options.config from an unset env var; a programmatic caller that assumed the loader has a built-in default.

Related errors


AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13). Data as JSON: /api/errors/19b7323844cd864c. Report an issue: GitHub.