{"record":{"id":"4bd7f6bfdb26663c","repo":"phacility/phabricator","slug":"this-private-key-could-not-be-opened-with-the-prov","errorCode":null,"errorMessage":"This private key could not be opened with the provided passphrase. This might mean that the passphrase is wrong or that the key is not formatted correctly. Check that you have supplied the complete text of a valid private key and the correct passphrase.","messagePattern":"This private key could not be opened with the provided passphrase\\. This might mean that the passphrase is wrong or that the key is not formatted correctly\\. Check that you have supplied the complete text of a valid private key and the correct passphrase\\.","errorType":"exception","errorClass":"PhabricatorAuthSSHPrivateKeyUnknownException","httpStatus":null,"severity":"error","filePath":"src/applications/auth/sshkey/PhabricatorAuthSSHPrivateKey.php","lineNumber":186,"sourceCode":"\n    if ($reason === $reason_passphrase) {\n      if ($passphrase) {\n        throw new PhabricatorAuthSSHPrivateKeyIncorrectPassphraseException(\n          pht(\n            'This private key requires a passphrase, but the wrong '.\n            'passphrase was provided. Check that you supplied the correct '.\n            'key and passphrase.'));\n      } else {\n        throw new PhabricatorAuthSSHPrivateKeyIncorrectPassphraseException(\n          pht(\n            'This private key requires a passphrase, but no passphrase was '.\n            'provided. Check that you supplied the correct key, or provide '.\n            'the passphrase.'));\n      }\n    }\n\n    if ($passphrase) {\n      throw new PhabricatorAuthSSHPrivateKeyUnknownException(\n        pht(\n          'This private key could not be opened with the provided passphrase. '.\n          'This might mean that the passphrase is wrong or that the key is '.\n          'not formatted correctly. Check that you have supplied the '.\n          'complete text of a valid private key and the correct passphrase.'));\n    } else {\n      throw new PhabricatorAuthSSHPrivateKeyUnknownException(\n        pht(\n          'This private key could not be opened. This might mean that the '.\n          'key requires a passphrase, or might mean that the key is not '.\n          'formatted correctly. Check that you have supplied the complete '.\n          'text of a valid private key and the correct passphrase.'));\n    }\n  }\n\n  private function newTemporaryPrivateKeyFile(PhutilOpaqueEnvelope $key_body) {\n    $tmp = new TempFile();\n","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/auth/sshkey/PhabricatorAuthSSHPrivateKey.php#L168-L204","documentation":"Fallback branch of PhabricatorAuthSSHPrivateKey: ssh-keygen failed, no pattern matched its diagnostics, and a passphrase was present, so the cause cannot be determined - either the passphrase is wrong or the key text is malformed. The generic PhabricatorAuthSSHPrivateKeyUnknownException tells the user to check both.","triggerScenarios":"newBarePrivateKey($passphrase) where the installed ssh-keygen version emits an unrecognized error message (version differences are called out in the source comment) while decrypting fails.","commonSituations":"Exotic or very new/old ssh-keygen builds with diagnostic strings Phabricator does not pattern-match; keys that are simultaneously truncated AND passphrase-protected.","solutions":["Verify the key text is complete: full BEGIN/END lines and intact base64 body","Verify the passphrase by testing locally with ssh-keygen -y -P 'pass' -f keyfile","Re-copy the key from its source and retry; if still failing, regenerate the key pair","Check which ssh-keygen binary runs ('which ssh-keygen') - an unusual build may be producing the opaque diagnostics"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  $bare = $private_key->newBarePrivateKey($passphrase);\n} catch (PhabricatorAuthSSHPrivateKeyUnknownException $ex) {\n  // Cause ambiguous: re-collect BOTH key text and passphrase,\n  // and run 'ssh-keygen -y -P ... -f ...' locally to disambiguate.\n  $ambiguous_failure = $ex;\n} catch (PhabricatorAuthSSHPrivateKeyException $ex) {\n  throw $ex;\n}","preventionTips":["Disambiguate locally before retrying: empty-passphrase ssh-keygen success = key unencrypted; passphrase prompt = encrypted; format error = bad text","Pin a known-good openssh-client version on hosts that handle keys - unrecognized diagnostics often come from unusual ssh-keygen builds"],"tags":["ssh","private-key","passphrase","phabricator","diagnostics"],"backgroundTag":"ssh-key-decrypt-failed","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}