affaan-m/ECC · error
Unsupported install target scope
Error message
Unsupported install target scope: ${scope} What it means
resolveBaseRoot only understands the scopes 'home' and 'project'; any other scope string reaches the final throw. This is a guard against typo'd or newly invented scope values reaching the target adapters before they are supported.
Solutions
- Check the scope value passed to the install target — it must be exactly 'home' or 'project'
- Fix the typo or wrong scope string in the caller or module manifest
- If you need a new scope, extend resolveBaseRoot in scripts/lib/install-targets/helpers.js to handle it
Example fix
// before
const root = baseRoot('global', input);
// after
const root = baseRoot('home', input); Defensive patterns
Strategy: validation
Validate before calling
const ALLOWED_SCOPES = ['home', 'project'];
if (!ALLOWED_SCOPES.includes(scope)) {
throw new Error(`scope must be one of ${ALLOWED_SCOPES.join(', ')}, got: ${scope}`);
} Type guard
function isValidScope(scope) {
return scope === 'home' || scope === 'project';
} Try / catch
try {
const root = baseRoot(scope, input);
} catch (e) {
if (/Unsupported install target scope/.test(e.message)) {
// map or correct the scope before retrying
} else throw e;
} Prevention
- Use the exact scope literals 'home' and 'project'; define them as constants
- Centralize scope selection in one module instead of scattering string literals
- When adding a new scope, update resolveBaseRoot and its tests together
When it happens
Trigger: baseRoot(scope, input) called with a scope other than 'home' or 'project' — e.g. 'global', 'workspace', a typo like 'projec', or a custom scope introduced by a third-party adapter.
Common situations: Adding a new install-target scope in a fork without extending resolveBaseRoot; misconfiguring a module's target scope in the manifest; a typo in a custom script calling the helper directly.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- projectRoot or repoRoot is required for project install…
- agent profile inheritance cycle
- An install config path is required
- application config exceeds local size limit
- Asset request_id/modality does not match the bundle
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/9d08751fb32698c0.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/lib/install-targets/helpers.js:59
}
return false;
}
function resolveBaseRoot(scope, input = {}) {
if (scope === 'home') {
return input.homeDir || os.homedir();
}
if (scope === 'project') {
const projectRoot = input.projectRoot || input.repoRoot;
if (!projectRoot) {
throw new Error('projectRoot or repoRoot is required for project install targets');
}
return projectRoot;
}
throw new Error(`Unsupported install target scope: ${scope}`);
}
function buildValidationIssue(severity, code, message, extra = {}) {
return {
severity,
code,
message,
...extra,
};
}
function listRelativeFiles(dirPath, prefix = '') {
if (!fs.existsSync(dirPath)) {
return [];
}
const entries = fs.readdirSync(dirPath, { withFileTypes: true }).sort((left, right) => (
left.name.localeCompare(right.name)View on GitHub (pinned to 8321021c54)