affaan-m/ECC · error · Error
Refusing to ${action} '${target}': no trusted install root r
Error message
Refusing to ${action} '${target}': no trusted install root resolved. What it means
Thrown by assertWithinTrustedRoot when `target` is a valid string but `root` (the trusted install root) is falsy. The guard cannot confine a path without a trusted root to confine against, so it fails closed rather than defaulting to cwd or any implicit base.
Source
Thrown at scripts/lib/path-safety.js:90
}
try {
return resolveContainment(target, root).contained;
} catch {
return false;
}
}
/**
* Fail-closed guard: throw unless `target` is contained within `root`.
* Returns the canonicalized target path on success.
*/
function assertWithinTrustedRoot(target, root, action = 'write') {
if (!target || typeof target !== 'string') {
throw new Error(`Refusing to ${action}: missing destination path.`);
}
if (!root) {
throw new Error(`Refusing to ${action} '${target}': no trusted install root resolved.`);
}
let containment;
try {
containment = resolveContainment(target, root);
} catch {
containment = null;
}
if (!containment || !containment.contained) {
throw new Error(`Refusing to ${action} outside the install root: '${target}' is not within '${root}'.`);
}
return containment.realTarget;
}
module.exports = {
realpathNearestExisting,
isWithinRoot,
assertWithinTrustedRootView on GitHub (pinned to 01e15490f0)
Solutions
- Resolve and verify a trusted root before invoking any install/repair/uninstall operation.
- Fail early with a clear error if no adapter root is available, instead of passing undefined downstream.
- Check isWithinRoot(target, root) returns false rather than calling assert when root may be absent.
- Ensure the harness/adapter is configured (e.g. CLAUDE_CONFIG_DIR) so the root resolves.
Example fix
// before
const trustedRoot = adapter.resolveRoot(); // returns undefined
assertWithinTrustedRoot(dest, trustedRoot, 'write');
// after
const trustedRoot = adapter.resolveRoot();
if (!trustedRoot) throw new Error('No trusted install root for harness ' + adapter.id);
assertWithinTrustedRoot(dest, trustedRoot, 'write'); Defensive patterns
Strategy: validation
Validate before calling
if (!root) throw new Error('No trusted install root resolved; configure the adapter.');
assertWithinTrustedRoot(target, root, action); Prevention
- Resolve and verify a trusted root before any install-lifecycle operation.
- Fail early with a clear error if the adapter cannot resolve its root.
- Ensure harness/adapter config (e.g. CLAUDE_CONFIG_DIR) is set.
When it happens
Trigger: Calling assertWithinTrustedRoot(dest, undefined, 'write'), assertWithinTrustedRoot(dest, '', 'write'), or passing a root derived from an adapter that returned null because no trusted root could be resolved for the current harness.
Common situations: An adapter (claude/cursor/codex) failing to resolve its target directory; a multi-harness setup where the harness type is unset so no root maps; running an install-lifecycle operation outside a project; a config migration that left the root resolution returning empty.
Related errors
- Refusing to ${action}: missing destination path.
- Refusing to ${action} outside the install root: '${target}'
- TypeScript compiler not found. Install root dev dependencies
- ${source} is missing the expected catalog marker
- Invalid ${flag}: expected a single cache path segment
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/564cbb47627aa446.
Report an issue: GitHub.