affaan-m/ECC · error · Error

Missing value for --family

Error message

Missing value for --family

What it means

The parseArgs function in scripts/catalog.js validates CLI flags. --family requires a following value that gets passed through normalizeFamily; when the flag is the last argument or is immediately followed by an empty token, no value exists and the parser throws 'Missing value for --family'.

Solutions

  1. Append the family value after --family: `catalog list --family skill`
  2. Quote values containing spaces or special shell characters
  3. Guard env interpolation so empty values fail early (e.g. ${FAMILY:?FAMILY required})
  4. Run `catalog --help` to see accepted --family values

Example fix

// before (FAMILY unset)
node scripts/catalog.js list --family $FAMILY
// after
node scripts/catalog.js list --family skill
Defensive patterns

Strategy: validation

Validate before calling

const idx = process.argv.indexOf('--family');
if (idx !== -1 && (idx + 1 >= process.argv.length || !process.argv[idx + 1])) {
  console.error('--family requires a value');
  process.exit(2);
}

Try / catch

try {
  const options = parseArgs(process.argv.slice(2));
} catch (err) {
  if (/Missing value for --/.test(err.message)) {
    console.error(`${err.message}\nUsage: catalog list --family <family>`);
    process.exit(2);
  }
  throw err;
}

Prevention

When it happens

Trigger: Running e.g. `node scripts/catalog.js list --family` with nothing after it; also `--family $FAMILY` with FAMILY unset (empty expansion) making args[index+1] falsy.

Common situations: Copy-pasting a command and truncating the value; shell splitting/interpolation dropping the value; forgetting that --family takes a value and treating it as boolean.

Understand the failure class

Background: "no subcommand specified" and "... is required": CLI errors when a required argument is missing — this error's family across 13 libraries.

Related errors


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

Appendix: source

Thrown at scripts/catalog.js:79

  };

  if (args.length === 0 || args[0] === '--help' || args[0] === '-h') {
    parsed.help = true;
    return parsed;
  }

  parsed.command = args[0];

  for (let index = 1; index < args.length; index += 1) {
    const arg = args[index];

    if (arg === '--help' || arg === '-h') {
      parsed.help = true;
    } else if (arg === '--json') {
      parsed.json = true;
    } else if (arg === '--family') {
      if (!args[index + 1]) {
        throw new Error('Missing value for --family');
      }
      parsed.family = normalizeFamily(args[index + 1]);
      index += 1;
    } else if (arg === '--target') {
      if (!args[index + 1]) {
        throw new Error('Missing value for --target');
      }
      parsed.target = args[index + 1];
      index += 1;
    } else if (parsed.command === 'show' && !parsed.componentId) {
      parsed.componentId = arg;
    } else {
      throw new Error(`Unknown argument: ${arg}`);
    }
  }

  return parsed;
}

View on GitHub (pinned to 8321021c54)