{"record":{"id":"870a5fe5b3de7214","repo":"phacility/phabricator","slug":"this-private-key-could-not-be-opened-this-might-m","errorCode":null,"errorMessage":"This private key could not be opened. This might mean that the key requires a passphrase, or might mean 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\\. This might mean that the key requires a passphrase, or might mean 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":193,"sourceCode":"            '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\n    Filesystem::writeFile($tmp, $key_body->openEnvelope());\n\n    return $tmp;\n  }\n\n}\n","sourceCodeStart":175,"sourceCodeEnd":211,"githubUrl":"https://github.com/phacility/phabricator/blob/5720a38cfe95b00ca4be5016dd0d2f3195f4fa04/src/applications/auth/sshkey/PhabricatorAuthSSHPrivateKey.php#L175-L211","documentation":"The no-passphrase twin of the unknown branch: ssh-keygen failed with unrecognized diagnostics and no passphrase was supplied. The thrown PhabricatorAuthSSHPrivateKeyUnknownException explains the key either requires a passphrase or is not formatted correctly.","triggerScenarios":"newBarePrivateKey() without a passphrase where decryption fails for an indeterminate reason on the host's ssh-keygen build.","commonSituations":"Importing an encrypted key with the passphrase field left blank on a host whose ssh-keygen error text Phabricator cannot classify; malformed keys with no passphrase involved.","solutions":["Try again with the key's passphrase if it has one","Verify the key text is complete and untruncated (BEGIN/END lines intact)","Test locally: 'ssh-keygen -y -f keyfile' - a passphrase prompt confirms encryption; an error confirms bad format","As a last resort, regenerate the key pair and import the new key"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  $bare = $private_key->newBarePrivateKey();\n} catch (PhabricatorAuthSSHPrivateKeyUnknownException $ex) {\n  // Either the key needs a passphrase or the text is broken:\n  // offer the user both prompts (passphrase + re-upload).\n  $offer_both = true;\n} catch (PhabricatorAuthSSHPrivateKeyException $ex) {\n  throw $ex;\n}","preventionTips":["Run 'ssh-keygen -y -f keyfile' locally: a passphrase prompt means supply one; an error means fix the key text","Keep full-file copies of private keys rather than clipboard snippets to avoid truncation"],"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"}