thephpleague/flysystem · error · League\Flysystem\PhpseclibV3\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/PhpseclibV3/SftpConnectionProvider.php:209
}
throw UnableToAuthenticate::withPrivateKey($connection->getLastError());
}
private function loadPrivateKey(): AsymmetricKey
{
if (("---" !== substr($this->privateKey, 0, 3) || "PuTTY" !== substr($this->privateKey, 0, 5)) && is_file($this->privateKey)) {
$this->privateKey = file_get_contents($this->privateKey);
}
try {
if ($this->passphrase !== null) {
return PublicKeyLoader::load($this->privateKey, $this->passphrase);
}
return PublicKeyLoader::load($this->privateKey);
} catch (NoKeyLoadedException $exception) {
throw new UnableToLoadPrivateKey(null, $exception);
}
}
private function authenticateWithAgent(SFTP $connection): void
{
$agent = new Agent();
if ( ! $connection->login($this->username, $agent)) {
throw UnableToAuthenticate::withSshAgent($connection->getLastError());
}
}
}
View on GitHub (pinned to b277b5dc3d)
When it happens
Trigger: Thrown at src/PhpseclibV3/SftpConnectionProvider.php:209 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/5e309ebc6239921b.
Report an issue: GitHub.