{"record":{"id":"97d41308b58315ce","repo":"phacility/phabricator","slug":"this-private-key-requires-a-passphrase-but-the-wr","errorCode":null,"errorMessage":"This private key requires a passphrase, but the wrong passphrase was provided. Check that you supplied the correct key and passphrase.","messagePattern":"This private key requires a passphrase, but the wrong passphrase was provided\\. Check that you supplied the correct key and passphrase\\.","errorType":"exception","errorClass":"PhabricatorAuthSSHPrivateKeyIncorrectPassphraseException","httpStatus":null,"severity":"error","filePath":"src/applications/auth/sshkey/PhabricatorAuthSSHPrivateKey.php","lineNumber":171,"sourceCode":"            $pattern));\n      }\n\n      if ($ok) {\n        $reason = $pattern_reason;\n        break;\n      }\n    }\n\n    if ($reason === $reason_format) {\n      throw new PhabricatorAuthSSHPrivateKeyFormatException(\n        pht(\n          'This private key is not formatted correctly. Check that you '.\n          'have provided the complete text of a valid private key.'));\n    }\n\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 '.","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/auth/sshkey/PhabricatorAuthSSHPrivateKey.php#L153-L189","documentation":"When ssh-keygen's diagnostics match the 'passphrase' pattern (the key is passphrase-protected) and a passphrase was supplied but decryption still failed, PhabricatorAuthSSHPrivateKeyIncorrectPassphraseException is thrown with this 'wrong passphrase was provided' wording: the key is fine, the passphrase is not.","triggerScenarios":"Calling newBarePrivateKey($passphrase) with a passphrase that does not match this particular encrypted key.","commonSituations":"Typos, wrong keyboard layout or caps-lock during passphrase entry; the key was re-encrypted with a new passphrase but the stored credential still has the old one; multiple keys with similar passphrases.","solutions":["Re-enter the correct passphrase for this key","Verify locally: ssh-keygen -y -P 'your passphrase' -f keyfile must succeed","If the passphrase is lost, regenerate the key pair and update the credential - there is no recovery path"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  $bare = $private_key->newBarePrivateKey($passphrase);\n} catch (PhabricatorAuthSSHPrivateKeyIncorrectPassphraseException $ex) {\n  // Wrong passphrase: re-prompt the user (do NOT auto-retry in a loop).\n  $passphrase_error = $ex->getMessage();\n} catch (PhabricatorAuthSSHPrivateKeyException $ex) {\n  throw $ex;\n}","preventionTips":["Validate the passphrase locally (ssh-keygen -y -P '...' -f key) before storing the credential","After changing a key's passphrase, update the stored credential immediately","Show the distinction between wrong-passphrase and bad-format errors to users - it halves debugging"],"tags":["ssh","private-key","passphrase","phabricator"],"backgroundTag":"ssh-key-passphrase-mismatch","analyzedSha":"5720a38cfe95b00ca4be5016dd0d2f3195f4fa04","analyzedAt":"2026-08-21T05:07:25.672Z","schemaVersion":2},"datasetVersion":"2026-08-21T11:28:35.574Z"}