{"record":{"id":"de7c6a87c84135b8","repo":"affaan-m/ECC","slug":"invalid-scope-scope","errorCode":null,"errorMessage":"Invalid scope: ${scope}","messagePattern":"Invalid scope: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"scripts/harness-audit.js","lineNumber":65,"sourceCode":"  },\n  Fly: {\n    detect: (rootDir) => fileExists(rootDir, 'fly.toml'),\n    keyPattern: /fly[_-]?(api|io)/i,\n    buildPattern: /fly\\s+(deploy|launch)/i,\n    workflowPattern: /(superfly\\/flyctl-actions|flyctl\\s+deploy|fly\\s+deploy)/i,\n  },\n};\n\nfunction getApplicableProviders(rootDir) {\n  return Object.entries(PROVIDERS)\n    .filter(([_, spec]) => spec.detect(rootDir))\n    .map(([name]) => name);\n}\n\nfunction normalizeScope(scope) {\n  const value = (scope || 'repo').toLowerCase();\n  if (!['repo', 'hooks', 'skills', 'commands', 'agents'].includes(value)) {\n    throw new Error(`Invalid scope: ${scope}`);\n  }\n  return value;\n}\n\nfunction parseArgs(argv) {\n  const args = argv.slice(2);\n  const parsed = {\n    scope: 'repo',\n    format: 'text',\n    help: false,\n    root: path.resolve(process.env.AUDIT_ROOT || process.cwd()),\n  };\n\n  for (let index = 0; index < args.length; index += 1) {\n    const arg = args[index];\n\n    if (arg === '--help' || arg === '-h') {\n      parsed.help = true;","sourceCodeStart":47,"sourceCodeEnd":83,"githubUrl":"https://github.com/affaan-m/ECC/blob/01e15490f04e29cfefe3896951f43db46994d8ee/scripts/harness-audit.js#L47-L83","documentation":"Thrown by normalizeScope() in scripts/harness-audit.js when the --scope argument receives a value that is not one of the five allowed scopes: 'repo', 'hooks', 'skills', 'commands', or 'agents'. The function lowercases the input and validates against the whitelist before returning.","triggerScenarios":"Running `node scripts/harness-audit.js --scope tools`, `--scope plugins`, `--scope rules`, or any value outside the five allowed scopes. The default is 'repo' if no --scope is provided.","commonSituations":"Using a scope name from documentation of a different version, a typo, or a logical name that is not a recognized audit scope (e.g. 'config', 'mcp', 'scripts').","solutions":["Use one of: --scope repo, --scope hooks, --scope skills, --scope commands, or --scope agents.","Omit --scope entirely to use the default 'repo' scope.","Run --help to see all valid scope values."],"exampleFix":"// before\nnode scripts/harness-audit.js --scope tools\n// after\nnode scripts/harness-audit.js --scope skills","handlingStrategy":"validation","validationCode":"const VALID_SCOPES = ['repo', 'hooks', 'skills', 'commands', 'agents'];\nif (!VALID_SCOPES.includes((scope || 'repo').toLowerCase())) {\n  console.error(`Invalid scope: ${scope}. Valid scopes: ${VALID_SCOPES.join(', ')}`);\n  process.exit(1);\n}","typeGuard":"function isValidScope(scope) {\n  return ['repo', 'hooks', 'skills', 'commands', 'agents'].includes((scope || 'repo').toLowerCase());\n}","tryCatchPattern":null,"preventionTips":["Use --help to see the list of valid scopes.","Omit --scope to use the default 'repo' scope.","Validate scope values from configuration or user input before invoking."],"tags":["cli","argument-parsing","audit","validation"],"backgroundTag":null,"analyzedSha":"01e15490f04e29cfefe3896951f43db46994d8ee","analyzedAt":"2026-08-13T00:31:08.655Z","schemaVersion":2},"datasetVersion":"2026-08-13T04:17:16.726Z"}