{"record":{"id":"5e309ebc6239921b","repo":"thephpleague/flysystem","slug":"unable-to-load-private-key-5e309e","errorCode":null,"errorMessage":"Unable to load private key.","messagePattern":"Unable to load private key\\.","errorType":"exception","errorClass":"League\\Flysystem\\PhpseclibV3\\UnableToLoadPrivateKey","httpStatus":null,"severity":"error","filePath":"src/PhpseclibV3/SftpConnectionProvider.php","lineNumber":209,"sourceCode":"        }\n\n        throw UnableToAuthenticate::withPrivateKey($connection->getLastError());\n    }\n\n    private function loadPrivateKey(): AsymmetricKey\n    {\n        if ((\"---\" !== substr($this->privateKey, 0, 3) || \"PuTTY\" !== substr($this->privateKey, 0, 5)) && is_file($this->privateKey)) {\n            $this->privateKey = file_get_contents($this->privateKey);\n        }\n\n        try {\n            if ($this->passphrase !== null) {\n                return PublicKeyLoader::load($this->privateKey, $this->passphrase);\n            }\n\n            return PublicKeyLoader::load($this->privateKey);\n        } catch (NoKeyLoadedException $exception) {\n            throw new UnableToLoadPrivateKey(null, $exception);\n        }\n    }\n\n    private function authenticateWithAgent(SFTP $connection): void\n    {\n        $agent = new Agent();\n\n        if ( ! $connection->login($this->username, $agent)) {\n            throw UnableToAuthenticate::withSshAgent($connection->getLastError());\n        }\n    }\n}\n","sourceCodeStart":191,"sourceCodeEnd":222,"githubUrl":"https://github.com/thephpleague/flysystem/blob/b277b5dc3d56650b68904117124e79c851e12376/src/PhpseclibV3/SftpConnectionProvider.php#L191-L222","documentation":"Error \"Unable to load private key.\" thrown in thephpleague/flysystem.","triggerScenarios":"Thrown at src/PhpseclibV3/SftpConnectionProvider.php:209 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b277b5dc3d56650b68904117124e79c851e12376","analyzedAt":"2026-08-17T04:28:35.741Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}