{"record":{"id":"e5fd308be9877f93","repo":"affaan-m/ECC","slug":"missing-value-for-action","errorCode":null,"errorMessage":"Missing value for --action","messagePattern":"Missing value for --action","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/welcome.js","lineNumber":27,"sourceCode":"const VALID_ACTIONS = new Set([\n  'installed',\n  'updated',\n  'configured',\n  'migrated',\n  'resumed',\n  'already-migrated',\n]);\n\nfunction parseArgs(argv) {\n  let action = 'installed';\n  let version;\n\n  for (let index = 0; index < argv.length; index += 1) {\n    const argument = argv[index];\n    if (argument === '--action') {\n      const value = argv[index + 1];\n      if (!value || value.startsWith('--')) {\n        throw new Error('Missing value for --action');\n      }\n      action = value;\n      index += 1;\n    } else if (argument === '--version') {\n      const value = argv[index + 1];\n      if (!value || value.startsWith('--')) {\n        throw new Error('Missing value for --version');\n      }\n      version = value;\n      index += 1;\n    } else {\n      throw new Error('Unknown argument');\n    }\n  }\n\n  if (!VALID_ACTIONS.has(action)) {\n    throw new Error('Invalid --action value');\n  }","sourceCodeStart":9,"sourceCodeEnd":45,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/welcome.js#L9-L45","documentation":"Thrown by scripts/welcome.js parseArgs when --action is passed but the next argv token is missing or itself starts with '--' (i.e. looks like another flag). The parser explicitly guards `if (!value || value.startsWith('--'))` because naively consuming the next flag as the action value would silently corrupt parsing. --action selects which welcome banner variant to render, so it must be a concrete value.","triggerScenarios":"`node scripts/welcome.js --action` (last token); `node scripts/welcome.js --action --version 2.2.0` (--action immediately followed by another flag).","commonSituations":"A post-install hook that passes `--action $ACTION` where $ACTION is empty in a particular install path; reordering flags and leaving --action dangling; a template where the action placeholder was never substituted.","solutions":["Supply one of the valid action values (installed, updated, configured, migrated, resumed, already-migrated) immediately after --action.","If the action is optional, omit --action entirely (it defaults to 'installed').","Ensure the wrapper script interpolates a non-empty, non-flag value for the action."],"exampleFix":"// before\nnode scripts/welcome.js --action\n\n// after\nnode scripts/welcome.js --action installed","handlingStrategy":"validation","validationCode":"const VALID_ACTIONS = new Set(['installed','updated','configured','migrated','resumed','already-migrated']);\nconst action = process.env.ECC_WELCOME_ACTION;\nconst args = [];\nif (action && VALID_ACTIONS.has(action)) {\n  args.push('--action', action);\n}\n// omit --action entirely to let welcome.js default to 'installed'","typeGuard":"function isValidAction(value) {\n  return typeof value === 'string'\n    && ['installed','updated','configured','migrated','resumed','already-migrated'].includes(value);\n}","tryCatchPattern":null,"preventionTips":["Only pass --action when the value is one of the six canonical lifecycle events.","If unsure, omit --action; the default 'installed' banner is correct for most install paths.","Validate the action against the VALID_ACTIONS set in your install hook before invoking welcome.js."],"tags":["cli","argument-parsing","missing-value","welcome"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}