langchain-ai/deepagents · error · SystemExit
Error: Could not clear trusted directories.
Error message
Error: Could not clear trusted directories.
What it means
The `skills trust clear` subcommand calls `clear_trusted_skill_dirs()`; if it returns a falsy value the store could not be cleared, so `_trust` prints `Error: Could not clear trusted directories.` and raises `SystemExit(1)`. This prevents a success message or `"cleared": true` JSON envelope when the on-disk store was not actually reset.
Source
Thrown at libs/code/deepagents_code/skills/commands.py:982
match result:
case RevokeResult.REMOVED:
console.print(
f"{checkmark} Revoked trust for: {escape(str(target))}",
style=theme.PRIMARY,
)
case RevokeResult.NOT_FOUND:
# Report honestly, not a false success.
console.print(
f"[yellow]No trust entry found for:[/yellow] {escape(str(target))}"
)
case _: # pragma: no cover - exhaustiveness guard
assert_never(result)
elif command == "clear":
if not clear_trusted_skill_dirs():
console.print(
"[bold red]Error:[/bold red] Could not clear trusted directories."
)
raise SystemExit(1)
if output_format == "json":
from deepagents_code.output import write_json
write_json("skills trust clear", {"cleared": True})
return
console.print(
f"{checkmark} Cleared all trusted skill directories.",
style=theme.PRIMARY,
)
else:
from deepagents_code.ui import show_skills_trust_help
show_skills_trust_help()
def setup_skills_parser(
subparsers: Any, # noqa: ANN401 # argparse subparsers uses dynamic typing
*,View on GitHub (pinned to a1af029e6e)
Solutions
- Check ownership/permissions on the profile directory and trust store file
- Free disk space if the disk was full and retry
- Remove the trust store file manually (after backup) so the next run starts with an empty store
- Re-run `dcode skills trust clear` and confirm the success message
Example fix
// before $ dcode skills trust clear # Error: Could not clear trusted directories. // after $ ls -l ~/.deepagents/skills/trust.json && rm ~/.deepagents/skills/trust.json $ dcode skills trust clear # now succeeds
Defensive patterns
Strategy: validation
Validate before calling
import os
from pathlib import Path
def can_clear_store(store: Path) -> bool:
return store.exists() is False or (os.access(store, os.W_OK) and os.access(store.parent, os.W_OK)) Try / catch
if not clear_trusted_skill_dirs():
print('could not clear trusted directories; check store permissions')
raise SystemExit(1) Prevention
- Run the CLI as the user who owns the profile directory
- Ensure the profile directory is writable and has free disk space
- Back up trust.json before clearing
- After clearing, verify with `skills trust list` that the store is empty
When it happens
Trigger: `skills trust clear` when `clear_trusted_skill_dirs()` fails to write or reset the trust store — unwritable file, unwritable parent directory, or an I/O error while replacing the store.
Common situations: Running the CLI as a different user than the one who owns the profile directory; read-only home or NFS mount; disk-full conditions while rewriting the trust store.
Related errors
- Could not resolve {label} path {raw_path!r}: {exc}. Ensure t
- Could not read rubric file {path!r}: {exc}.
- Error: Could not create project skills directory.
- Error: Cannot determine base skills directory. Refusing to d
- Error: Failed to fully delete skill: {e} Warning: Some files
AI-assisted analysis of langchain-ai/deepagents@a1af029e6e (2026-08-29).
Data as JSON: /api/errors/e5ca088a68133ddc.
Report an issue: GitHub.