affaan-m/ECC · error
Invalid scope: ${scope}
Error message
Invalid scope: ${scope} What it means
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.
Source
Thrown at scripts/harness-audit.js:65
},
Fly: {
detect: (rootDir) => fileExists(rootDir, 'fly.toml'),
keyPattern: /fly[_-]?(api|io)/i,
buildPattern: /fly\s+(deploy|launch)/i,
workflowPattern: /(superfly\/flyctl-actions|flyctl\s+deploy|fly\s+deploy)/i,
},
};
function getApplicableProviders(rootDir) {
return Object.entries(PROVIDERS)
.filter(([_, spec]) => spec.detect(rootDir))
.map(([name]) => name);
}
function normalizeScope(scope) {
const value = (scope || 'repo').toLowerCase();
if (!['repo', 'hooks', 'skills', 'commands', 'agents'].includes(value)) {
throw new Error(`Invalid scope: ${scope}`);
}
return value;
}
function parseArgs(argv) {
const args = argv.slice(2);
const parsed = {
scope: 'repo',
format: 'text',
help: false,
root: path.resolve(process.env.AUDIT_ROOT || process.cwd()),
};
for (let index = 0; index < args.length; index += 1) {
const arg = args[index];
if (arg === '--help' || arg === '-h') {
parsed.help = true;View on GitHub (pinned to 01e15490f0)
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.
Example fix
// before node scripts/harness-audit.js --scope tools // after node scripts/harness-audit.js --scope skills
Defensive patterns
Strategy: validation
Validate before calling
const VALID_SCOPES = ['repo', 'hooks', 'skills', 'commands', 'agents'];
if (!VALID_SCOPES.includes((scope || 'repo').toLowerCase())) {
console.error(`Invalid scope: ${scope}. Valid scopes: ${VALID_SCOPES.join(', ')}`);
process.exit(1);
} Type guard
function isValidScope(scope) {
return ['repo', 'hooks', 'skills', 'commands', 'agents'].includes((scope || 'repo').toLowerCase());
} Prevention
- 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.
When it happens
Trigger: 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.
Common situations: 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').
Related errors
- ${label} must be a positive integer
- Unknown install target: ${parsed.target}. Expected one of ${
- Invalid ${flagName}: ${value}
- Invalid format: ${parsed.format}. Use text, json, or markdow
- --write requires --json, --markdown, or --format json|markdo
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/de7c6a87c84135b8.
Report an issue: GitHub.