phacility/phabricator · warning · PhutilArgumentUsageException
Public key with ID %s is not trusted.
Error message
Public key with ID %s is not trusted.
What it means
The untrust-key workflow refuses to operate because the key exists but its isTrusted flag is already 0. Untrusting is only meaningful for trusted keys, so the workflow fails fast before writing anything.
Source
Thrown at src/applications/almanac/management/AlmanacManagementUntrustKeyWorkflow.php:39
$console = PhutilConsole::getConsole();
$id = $args->getArg('id');
if (!$id) {
throw new PhutilArgumentUsageException(
pht('Specify a public key to revoke trust for with --id.'));
}
$key = id(new PhabricatorAuthSSHKeyQuery())
->setViewer($this->getViewer())
->withIDs(array($id))
->executeOne();
if (!$key) {
throw new PhutilArgumentUsageException(
pht('No public key exists with ID "%s".', $id));
}
if (!$key->getIsTrusted()) {
throw new PhutilArgumentUsageException(
pht('Public key with ID %s is not trusted.', $id));
}
$key->setIsTrusted(0);
$key->save();
PhabricatorAuthSSHKeyQuery::deleteSSHKeyCache();
$console->writeOut(
"**<bg:green> %s </bg>** %s\n",
pht('TRUST REVOKED'),
pht('Trust has been revoked for public key %s.', $id));
}
}
View on GitHub (pinned to 5720a38cfe)
Solutions
- Verify the key's current trust state on its detail page; if already untrusted, no action is needed.
- If you meant a different key, find the trusted device key's ID and run untrust-key against that.
- Treat this as a no-op guard, not a corruption: nothing was changed.
Defensive patterns
Strategy: validation
Validate before calling
$key = id(new PhabricatorAuthSSHKeyQuery())
->setViewer($viewer)
->withIDs(array($id))
->executeOne();
if ($key && !$key->getIsTrusted()) {
// Already untrusted: skip the workflow instead of triggering its exception.
echo "Key {$id} is not trusted; nothing to do.\n";
return;
} Type guard
function isTrustedKey(PhabricatorAuthSSHKey $key) {
return (bool)$key->getIsTrusted();
} Try / catch
try {
// run untrust-key
} catch (PhutilArgumentUsageException $ex) {
if (preg_match('/is not trusted/', $ex->getMessage())) {
// Idempotent success: treat as no-op.
exit(0);
}
throw $ex;
} Prevention
- Make untrust operations idempotent in scripts: check isTrusted first, then act.
- After untrusting, record the key ID and state so re-runs skip it.
- Expect this exception when replaying historical commands; do not treat it as data loss.
When it happens
Trigger: Running ./bin/almanac untrust-key --id N on a key whose object was never trusted, was already untrusted by a previous run, or whose trust was revoked through the UI.
Common situations: Re-running an untrust command from history after it already succeeded; keying in the wrong ID that happens to belong to an untrusted user key.
Related errors
- Public key "%s" is not an active key.
- You can only trust keys associated with Almanac devices.
- User aborted workflow.
- Specify a public key to revoke trust for with --id.
- No public key exists with ID "%s".
AI-assisted analysis of phacility/phabricator@5720a38cfe (2026-08-21).
Data as JSON: /api/errors/43b6c76e2165af78.
Report an issue: GitHub.