{"record":{"id":"f68d23493469f561","repo":"affaan-m/ECC","slug":"invalid-action-value","errorCode":null,"errorMessage":"Invalid --action value","messagePattern":"Invalid --action value","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"scripts/welcome.js","lineNumber":44,"sourceCode":"      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  }\n  if (version !== undefined && !ECC_VERSION_PATTERN.test(version)) {\n    throw new Error('Invalid --version value');\n  }\n  return { action, version };\n}\n\nfunction main(argv = process.argv.slice(2)) {\n  try {\n    const { action, version } = parseArgs(argv);\n    const color = process.env.NO_COLOR === undefined\n      && process.env.TERM !== 'dumb'\n      && Boolean(process.stdout.isTTY);\n    process.stdout.write(renderTerminalWelcome({ action, color, version }));\n  } catch (error) {\n    process.stderr.write(`Error: ${error.message}\\n`);\n    process.exitCode = 1;\n  }","sourceCodeStart":26,"sourceCodeEnd":62,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/welcome.js#L26-L62","documentation":"Thrown by scripts/welcome.js after parsing when the --action value is not a member of the VALID_ACTIONS set: installed, updated, configured, migrated, resumed, or already-migrated. These are the only lifecycle events for which a welcome banner exists. The check runs post-parse so that a missing --action (which defaults to 'installed') never trips it — only an explicitly supplied unknown value does.","triggerScenarios":"`node scripts/welcome.js --action upgraded` (not in set); `--action install` (close but the valid value is 'installed'); `--action removed` (no banner for removal).","commonSituations":"Install hooks using a free-form action string that drifted from the canonical set; a refactor that renamed an action (e.g. 'migrate' -> 'migrated') without updating callers; guessing an action name instead of consulting the set.","solutions":["Use one of the six canonical values: installed, updated, configured, migrated, resumed, already-migrated.","If the lifecycle event you want is not listed, either omit --action (defaults to 'installed') or extend the VALID_ACTIONS set and add a matching banner.","Audit the install/update hooks that invoke welcome.js to ensure they pass a canonical action."],"exampleFix":"// before\nnode scripts/welcome.js --action upgraded\n\n// after\nnode scripts/welcome.js --action updated","handlingStrategy":"type-guard","validationCode":"const VALID_ACTIONS = new Set(['installed','updated','configured','migrated','resumed','already-migrated']);\nfunction buildWelcomeArgs(action, version) {\n  const args = [];\n  if (action && VALID_ACTIONS.has(action)) {\n    args.push('--action', action);\n  } else if (action) {\n    throw new Error(`Unknown welcome action: ${action}. Valid: ${[...VALID_ACTIONS].join(', ')}`);\n  }\n  if (version) args.push('--version', version);\n  return args;\n}","typeGuard":"function isValidAction(value) {\n  return typeof value === 'string'\n    && ['installed','updated','configured','migrated','resumed','already-migrated'].includes(value);\n}","tryCatchPattern":null,"preventionTips":["Source the action list from the same VALID_ACTIONS set the script uses.","When renaming an action, update all callers in the same commit.","Add a test enumerating each valid action to catch regressions."],"tags":["cli","argument-parsing","welcome","enum","validation"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}