thephpleague/flysystem · error · RuntimeException
Unexpected status code received:
Error message
Unexpected status code received:
What it means
Error "Unexpected status code received: " thrown in thephpleague/flysystem.
Source
Thrown at src/WebDAV/WebDAVAdapter.php:133
public function writeStream(string $path, $contents, Config $config): void
{
$this->upload($path, $contents);
}
/**
* @param resource|string $contents
*/
private function upload(string $path, mixed $contents): void
{
$this->createParentDirFor($path);
$location = $this->encodePath($this->prefixer->prefixPath($path));
try {
$response = $this->client->request('PUT', $location, $contents);
$statusCode = $response['statusCode'];
if ($statusCode < 200 || $statusCode >= 300) {
throw new RuntimeException('Unexpected status code received: ' . $statusCode);
}
} catch (Throwable $exception) {
throw UnableToWriteFile::atLocation($path, $exception->getMessage(), $exception);
}
}
public function read(string $path): string
{
$location = $this->encodePath($this->prefixer->prefixPath($path));
try {
$response = $this->client->request('GET', $location);
if ($response['statusCode'] !== 200) {
throw new RuntimeException('Unexpected response code for GET: ' . $response['statusCode']);
}
return $response['body'];View on GitHub (pinned to b277b5dc3d)
When it happens
Trigger: Thrown at src/WebDAV/WebDAVAdapter.php:133 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/1562001828937611.
Report an issue: GitHub.