thephpleague/flysystem · error · League\Flysystem\PhpseclibV2\UnableToLoadPrivateKey
Unable to load private key.
Error message
Unable to load private key.
What it means
Error "Unable to load private key." thrown in thephpleague/flysystem.
Source
Thrown at src/PhpseclibV2/SftpConnectionProvider.php:226
}
throw UnableToAuthenticate::withPrivateKey();
}
private function loadPrivateKey(): RSA
{
if ("---" !== substr($this->privateKey, 0, 3) && is_file($this->privateKey)) {
$this->privateKey = file_get_contents($this->privateKey);
}
$key = new RSA();
if ($this->passphrase !== null) {
$key->setPassword($this->passphrase);
}
if ( ! $key->loadKey($this->privateKey)) {
throw new UnableToLoadPrivateKey();
}
return $key;
}
private function authenticateWithAgent(SFTP $connection): void
{
$agent = new Agent();
if ( ! $connection->login($this->username, $agent)) {
throw UnableToAuthenticate::withSshAgent();
}
}
}
View on GitHub (pinned to b277b5dc3d)
When it happens
Trigger: Thrown at src/PhpseclibV2/SftpConnectionProvider.php:226 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of thephpleague/flysystem@b277b5dc3d (2026-08-17).
Data as JSON: /api/errors/524d6356d30a1bf0.
Report an issue: GitHub.