{"record":{"id":"91752d0693095e41","repo":"langchain-ai/deepagents","slug":"error-could-not-revoke-trust-for-target","errorCode":null,"errorMessage":"Error: Could not revoke trust for: {target}","messagePattern":"Error: Could not revoke trust for: (.+?)","errorType":"console","errorClass":"SystemExit","httpStatus":null,"severity":"error","filePath":"libs/code/deepagents_code/skills/commands.py","lineNumber":951,"sourceCode":"        for path, trusted_at in entries:\n            console.print(f\"  {escape(str(path))}\")\n            if trusted_at:\n                console.print(\n                    f\"    [dim]trusted {escape(trusted_at)}[/dim]\", style=theme.MUTED\n                )\n        console.print()\n    elif command == \"revoke\":\n        target = args.dir\n        result = revoke_skill_dir_trust(target)\n        # An I/O/read failure is a hard error regardless of output format\n        # (matching `list`): print red and exit non-zero without emitting a\n        # success envelope a script might misread.\n        if result is RevokeResult.ERROR:\n            console.print(\n                \"[bold red]Error:[/bold red] Could not revoke trust for: \"\n                f\"{escape(str(target))}\"\n            )\n            raise SystemExit(1)\n        if output_format == \"json\":\n            from deepagents_code.output import write_json\n\n            write_json(\n                \"skills trust revoke\",\n                {\"dir\": str(target), \"result\": result.value},\n            )\n            return\n        # `ERROR` was handled above (early exit), so only `REMOVED`/`NOT_FOUND`\n        # remain. Match exhaustively with `assert_never` so adding a future\n        # `RevokeResult` member is a static error here rather than a silent\n        # success that prints nothing yet exits 0.\n        match result:\n            case RevokeResult.REMOVED:\n                console.print(\n                    f\"{checkmark} Revoked trust for: {escape(str(target))}\",\n                    style=theme.PRIMARY,\n                )","sourceCodeStart":933,"sourceCodeEnd":969,"githubUrl":"https://github.com/langchain-ai/deepagents/blob/a1af029e6e73cb17c36bff823d227747b28e91e1/libs/code/deepagents_code/skills/commands.py#L933-L969","documentation":"`skills trust revoke <target>` returns a `RevokeResult`; when it equals `RevokeResult.ERROR`, `_trust` prints `Error: Could not revoke trust for: <target>` and exits with status 1. The guard exists so the CLI fails loudly rather than emitting a success JSON envelope that scripts might misinterpret when the underlying store update fails.","triggerScenarios":"`skills trust revoke <dir>` when `revoke_skill_dir_trust` reports `ERROR` — typically the trust store could not be read or written (OSError, ValueError from `_load_store`, permissions), or the removal of the entry failed.","commonSituations":"Revoking trust while the trust store file is read-only or owned by another user; corrupted store content; revoking a path that was recorded under a different resolved form than the argument given.","solutions":["Check that the trust store file is writable by the current user","Run `skills trust list` to see the exact stored path and revoke that exact value","If the store is corrupt, back it up, delete it, and re-add the entries you still trust","Retry the revoke after fixing the filesystem issue"],"exampleFix":"// before\n$ dcode skills trust revoke ~/MySkills   # stored as /home/me/myskills\n# Error: Could not revoke trust for: /home/me/MySkills\n// after\n$ dcode skills trust list                 # get the exact stored path\n$ dcode skills trust revoke /home/me/myskills","handlingStrategy":"validation","validationCode":"from deepagents_code.skills.trust import _read_dirs\n\ndef is_trusted(target: str, store_path) -> bool:\n    return str(Path(target).resolve()) in dict(_read_dirs(store_path))","typeGuard":null,"tryCatchPattern":"from deepagents_code.skills.trust import RevokeResult\nresult = revoke_skill_dir_trust(Path(target).resolve())\nif result is RevokeResult.ERROR:\n    print(f'could not revoke trust for {target}; check store permissions')\n    raise SystemExit(1)","preventionTips":["Revoke the exact path shown by `skills trust list` (resolved, canonical form)","Ensure the trust store file is writable before revoking","Repair or recreate a corrupt store before further trust operations","Avoid running the CLI under a different user than the profile owner"],"tags":["cli","trust-store","revocation"],"backgroundTag":"trust-store-write-failed","analyzedSha":"a1af029e6e73cb17c36bff823d227747b28e91e1","analyzedAt":"2026-08-29T11:43:24.718Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}