thephpleague/flysystem · error · RuntimeException

Unexpected response code for GET:

Error message

Unexpected response code for GET: 

What it means

Error "Unexpected response code for GET: " thrown in thephpleague/flysystem.

Source

Thrown at src/WebDAV/WebDAVAdapter.php:148

            $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'];
        } catch (Throwable $exception) {
            throw UnableToReadFile::fromLocation($path, $exception->getMessage(), $exception);
        }
    }

    public function readStream(string $path)
    {
        $location = $this->encodePath($this->prefixer->prefixPath($path));

        try {
            $url = $this->client->getAbsoluteUrl($location);
            $request = new Request('GET', $url);
            $response = $this->client->send($request);
            $status = $response->getStatus();

View on GitHub (pinned to b277b5dc3d)

When it happens

Trigger: Thrown at src/WebDAV/WebDAVAdapter.php:148 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/ef711355844d23cb. Report an issue: GitHub.