affaan-m/ECC · error · Error

requires a non-empty value for live node qualification.

Error message

${option} requires a non-empty value for live node qualification.

What it means

requiredOptionValue() validates that the token following the option flag is a real, non-empty value. If the next argument is missing, blank/whitespace, or itself starts with '--' (i.e. another flag), the option has no usable value and the script throws before starting any process.

Solutions

  1. Provide a concrete non-empty value after the flag, e.g. --nodes node-a,node-b.
  2. Check shell variables for emptiness before interpolation: ${NODES:?NODES must be set}.
  3. Reorder arguments so a value — not another flag — immediately follows the option.

Example fix

// before
ito --live-sixtytwo --cluster prod --nodes --live-sixtytwo
// after
ito --live-sixtytwo --cluster prod --nodes node-a,node-b
Defensive patterns

Strategy: validation

Validate before calling

const idx = args.indexOf(option); const val = args[idx + 1]; if (!val || !val.trim() || val.startsWith('--')) throw new Error(`${option} needs a non-empty value`);

Type guard

const hasOptionValue = (args, option) => { const i = args.indexOf(option); const v = i >= 0 ? args[i + 1] : undefined; return typeof v === 'string' && v.trim() !== '' && !v.startsWith('--'); };

Try / catch

try { runQualification(args); } catch (e) { if (e.message.includes('requires a non-empty value')) { console.error(`${e.message} — pass a real value after ${e.message.split(' ')[0]}`); process.exit(2); } throw e; }

Prevention

When it happens

Trigger: Invoking e.g. `--nodes --cluster prod` (next token is a flag), `--nodes` at end of args, or `--nodes " "` so value?.trim() is empty or value.startsWith('--') is true.

Common situations: Empty environment variables interpolated as the value (`--nodes "$NODES"` with NODES unset); forgetting the value entirely; accidental reordering that puts another flag where the value belongs.

Understand the failure class

Background: "unknown output mode", "invalid value for flag", "expects true/false": fixing invalid flag value errors in CLI tools — this error's family across 24 libraries.

Related errors


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

Appendix: source

Thrown at scripts/ito.js:101

Live node qualification requires ITO_ENABLE_SIXTYTWO_LIVE=1,
--live-sixtytwo, an explicit node list, and an existing absolute config
directory. It forwards only named SIXTYTWO_API_TOKEN/SIXTYTWO_TOKEN and SSH
agent state; ITO_API_KEY is intentionally excluded. The canonical CLI requires
sixtytwo-cli==0.3.33 and fails closed.
`);
}

function requiredOptionValue(args, option) {
  const indexes = args
    .map((value, index) => (value === option ? index : -1))
    .filter((index) => index >= 0);
  if (indexes.length !== 1) {
    throw new Error(`${option} is required exactly once for live node qualification.`);
  }
  const value = args[indexes[0] + 1];
  if (!value?.trim() || value.startsWith("--")) {
    throw new Error(`${option} requires a non-empty value for live node qualification.`);
  }
  return value;
}

function validateNodeQualificationArgs(args, environment) {
  if (environment.ITO_ENABLE_SIXTYTWO_LIVE !== "1") {
    throw new Error(
      "Live node qualification requires ITO_ENABLE_SIXTYTWO_LIVE=1 before any process is started."
    );
  }
  if (args.filter((value) => value === "--live-sixtytwo").length !== 1) {
    throw new Error(
      "Live node qualification requires --live-sixtytwo exactly once before any process is started."
    );
  }
  requiredOptionValue(args, "--cluster");
  const nodes = requiredOptionValue(args, "--nodes");
  if (!nodes.split(",").every((node) => node.trim().length > 0)) {

View on GitHub (pinned to 8321021c54)