affaan-m/ECC · error · Error
Refusing to trust managed install-state path: ${error.messag
Error message
Refusing to trust managed install-state path: ${error.message} What it means
Thrown by readOwnedDestinations when assertSafeInstallOperation(plan, { destinationPath: plan.installStatePath }) rejects the install-state path itself. assertSafeInstallOperation (from ./install/apply) and assertWithinTrustedRoot enforce that every destination stays inside the trusted project root and is not a dangerous/sensitive path. The original error message is wrapped so the caller sees the install-state path was the reason, preserving the underlying cause in error.message.
Source
Thrown at scripts/lib/multi-harness-setup.js:132
+ 'recorded root does not match the current install root.'
);
}
if (!pathsMatch(target.installStatePath, plan.installStatePath)) {
throw new Error(
`Refusing to trust managed install-state at ${plan.installStatePath}: `
+ 'recorded install-state path does not match the current install-state path.'
);
}
}
function readOwnedDestinations(plan, dependencies) {
if (!plan.installStatePath) {
return { destinations: new Set(), stateFingerprint: { exists: false, sha256: null } };
}
try {
assertSafeInstallOperation(plan, { destinationPath: plan.installStatePath });
} catch (error) {
throw new Error(`Refusing to trust managed install-state path: ${error.message}`);
}
if (!fs.existsSync(plan.installStatePath)) {
return { destinations: new Set(), stateFingerprint: { exists: false, sha256: null } };
}
const readState = dependencies.readInstallState || require('./install-state').readInstallState;
const initialFingerprint = fingerprintFile(plan.installStatePath);
const state = readState(plan.installStatePath);
const validatedFingerprint = fingerprintFile(plan.installStatePath);
if (
initialFingerprint.exists !== validatedFingerprint.exists
|| initialFingerprint.sha256 !== validatedFingerprint.sha256
) {
throw new Error(
`Refusing to trust install-state that changed during validation: ${plan.installStatePath}.`
);
}
assertPriorInstallStateMatchesPlan(state, plan);
const plannedByDestination = new Map(plan.operations.map(operation => [View on GitHub (pinned to 01e15490f0)
Solutions
- Inspect the wrapped message (error.message after the prefix) to see the exact path-safety violation.
- Ensure plan.installStatePath resolves (via realpath) inside plan.targetRoot.
- Pass consistent homeDir/projectRoot to createManagedPlan so the install-state path lands inside the trusted root.
- Remove symlinks that cause .claude to resolve outside the project, or move the state path inside targetRoot.
Example fix
// before: homeDir set outside project -> installStatePath escapes trusted root
const plan = await createManagedPlan(req, {
homeDir: '/tmp/elsewhere',
projectRoot: '/home/me/app',
});
await applyManaged(plan); // throws [284]: path outside trusted root
// after: keep install state inside the project root
const plan = await createManagedPlan(req, {
homeDir: os.homedir(),
projectRoot: '/home/me/app',
});
await applyManaged(plan); Defensive patterns
Strategy: validation
Validate before calling
const path = require('path'); const fs = require('fs');
function assertInstallStateWithinRoot(installStatePath, targetRoot) {
const resolved = fs.realpathSync(installStatePath); // throws if missing; guard as needed
const root = fs.realpathSync(targetRoot);
if (resolved !== root && !resolved.startsWith(root + path.sep)) {
throw new Error(`installStatePath ${resolved} escapes targetRoot ${root}; move it inside the project.`);
}
}
// before applying:
if (fs.existsSync(plan.installStatePath)) {
assertInstallStateWithinRoot(plan.installStatePath, plan.targetRoot);
} Type guard
null
Try / catch
try {
await applyMultiHarnessPlan(plan);
} catch (err) {
if (/Refusing to trust managed install-state path/.test(err.message)) {
// fix plan.installStatePath/homeDir/projectRoot so it resolves inside targetRoot, then retry
const fixed = await createManagedPlan(plan.request, { homeDir: os.homedir(), projectRoot: plan.targetRoot });
await applyManaged({ preview: preflightManagedPlan(fixed) });
} else throw err;
} Prevention
- Keep the install-state path inside the project root; do not point it at /tmp or HOME.
- Pass consistent homeDir and projectRoot to createManagedPlan.
- Avoid symlinking .claude outside the project.
- Resolve realpath of the state path before passing it to the plan.
When it happens
Trigger: Reached at the top of readOwnedDestinations for any plan with installStatePath set. Fires when the install-state path escapes plan.targetRoot (after realpath resolution), targets a protected location, or fails whatever path-safety predicate assertSafeInstallOperation enforces. Typical when homeDir/projectRoot passed to createManagedPlan place installStatePath outside the trusted root, or a symlink resolves outside.
Common situations: Custom homeDir pointing outside the project; projectRoot mismatch; installStatePath configured to an absolute path outside targetRoot; symlinked .claude dir resolving to a location outside the trusted root; running with elevated/changed HOME so the state path lands somewhere unexpected.
Related errors
- Refusing to overwrite an unowned or changed install-state at
- Refusing to trust managed install-state at ${plan.installSta
- Refusing to trust managed install-state at ${plan.installSta
- Refusing to trust managed install-state at ${plan.installSta
- Refusing to trust install-state that changed during validati
AI-assisted analysis of affaan-m/ECC@01e15490f0 (2026-08-13).
Data as JSON: /api/errors/597fe95c8b704892.
Report an issue: GitHub.