{"record":{"id":"f68d23493469f561","repo":"affaan-m/ECC","slug":"invalid-action-value","errorCode":null,"errorMessage":"Invalid --action value","messagePattern":"Invalid --action value","errorType":"validation","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/8321021c54d670126ce3b2969d5deb880b4b0c2a/scripts/welcome.js#L26-L62","documentation":"After parsing, parseArgs validates the action against the VALID_ACTIONS set. A syntactically valid --action value that is not a member of that set is rejected. This distinguishes well-formed but unsupported actions from missing values (error 671).","triggerScenarios":"`node scripts/welcome.js --action frobnicate` where 'frobnicate' is not in VALID_ACTIONS; also passing an empty-ish or differently-cased action like 'Install' if the set only contains lowercase entries.","commonSituations":"Guessing action names instead of checking docs; case mismatch ('Install' vs 'install'); outdated docs or muscle memory from a renamed action in a newer script version.","solutions":["Use one of the exact values in VALID_ACTIONS (read the top of scripts/welcome.js for the set)","Fix casing to match the declared constants","Check the repo README or welcome script docs for current action names","If a needed action is genuinely missing, this may be a version issue — update the repo"],"exampleFix":"// before\nnode scripts/welcome.js --action Install\n// after\nnode scripts/welcome.js --action install","handlingStrategy":"validation","validationCode":"const VALID_ACTIONS = new Set(['install', 'update', 'uninstall']);\nconst action = process.argv[process.argv.indexOf('--action') + 1];\nif (action !== undefined && !VALID_ACTIONS.has(action)) {\n  throw new Error(`Invalid --action value: ${action}`);\n}","typeGuard":"function isValidAction(value) {\n  return typeof value === 'string' && VALID_ACTIONS.has(value);\n}","tryCatchPattern":"try {\n  parseArgs(process.argv.slice(2));\n} catch (err) {\n  if (err.message === 'Invalid --action value') {\n    console.error(`Action must be one of: ${[...VALID_ACTIONS].join(', ')}`);\n    process.exit(2);\n  }\n  throw err;\n}","preventionTips":["Copy action names from docs rather than typing from memory","Watch for casing — actions are case-sensitive set members","Tab-complete from a wrapper script listing valid actions","Re-check docs after upgrading the repo in case actions were renamed"],"tags":["cli","validation","enum"],"backgroundTag":"invalid-enum-value","analyzedSha":"8321021c54d670126ce3b2969d5deb880b4b0c2a","analyzedAt":"2026-09-16T10:08:13.343Z","contentChangedAt":"2026-09-16T10:08:13.343Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}