affaan-m/ECC · error
Install module has invalid targets; expected an array of…
Error message
Install module ${moduleId} has invalid targets; expected an array of supported target ids What it means
readModuleTargetsOrThrow throws when an install module's `targets` property is not an array. The faulting input is the module object in the install-modules manifest; the schema expects an array of supported target ids (e.g. 'claude', 'codex', 'cursor').
Solutions
- Fix the module entry so targets is an array of valid target ids.
- Validate manifests against schemas/install-modules.schema.json before loading.
- Regenerate the manifest if it is produced by tooling.
Example fix
// before
{ "id": "agents", "targets": "claude" }
// after
{ "id": "agents", "targets": ["claude", "codex", "cursor"] } Defensive patterns
Strategy: validation
Validate before calling
const TARGETS = new Set(['claude','codex','cursor']);
function validateModule(m) { if (!Array.isArray(m.targets) || m.targets.some(t => !TARGETS.has(String(t).trim()))) throw new Error(`module ${m.id} has invalid targets`); } Type guard
const hasValidTargets = (m) => Array.isArray(m?.targets) && m.targets.every(t => typeof t === 'string' && t.trim());
Try / catch
try { loadInstallManifests(opts); } catch (e) { if (e.message.includes('has invalid targets')) { console.error('Fix the module targets array in the manifest:', e.message); } else throw e; } Prevention
- Validate module manifests against the schema before loading
- Always declare targets as a string array when adding modules
- Lint manifests in CI to catch schema drift
When it happens
Trigger: Loading install manifests where a module definition has targets missing, set to a string/object/null, or an array containing unsupported non-string entries that fail normalization.
Common situations: Hand-editing a module manifest and dropping or mistyping `targets`; adding a new module without declaring targets; schema change where targets became an object map.
Understand the failure class
Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.
Related errors
- Unknown install profile
- application config exceeds local size limit
- Asset request_id/modality does not match the bundle
- assets must be a nonempty list
- at least one genre spec is required
AI-assisted analysis of affaan-m/ECC@8321021c54 (2026-09-16).
Data as JSON: /api/errors/4427bbe3af5f54b4.
Report an issue: GitHub.
Appendix: source
Thrown at scripts/lib/install-manifests.js:251
|| options[key] === null
|| options[key] === undefined
) {
return null;
}
if (typeof options[key] !== 'string' || options[key].trim() === '') {
throw new Error(`${key} must be a non-empty string when provided`);
}
return options[key];
}
function readModuleTargetsOrThrow(module) {
const moduleId = module && module.id ? module.id : '<unknown>';
const targets = module && module.targets;
if (!Array.isArray(targets)) {
throw new Error(`Install module ${moduleId} has invalid targets; expected an array of supported target ids`);
}
const normalizedTargets = targets.map(target => (
typeof target === 'string' ? target.trim() : ''
));
if (normalizedTargets.some(target => target.length === 0)) {
throw new Error(`Install module ${moduleId} has invalid targets; expected an array of supported target ids`);
}
const unsupportedTargets = normalizedTargets.filter(target => !SUPPORTED_INSTALL_TARGETS.includes(target));
if (unsupportedTargets.length > 0) {
throw new Error(
`Install module ${moduleId} has unsupported targets: ${unsupportedTargets.join(', ')}`
);
}
return normalizedTargets;View on GitHub (pinned to 8321021c54)