thephpleague/flysystem · error · RuntimeException
Unexpected status code received while deleting file:
Error message
Unexpected status code received while deleting file:
What it means
Error "Unexpected status code received while deleting file: " thrown in thephpleague/flysystem.
Source
Thrown at src/WebDAV/WebDAVAdapter.php:186
throw new RuntimeException('Unexpected response code for GET: ' . $status);
}
return $response->getBodyAsStream();
} catch (Throwable $exception) {
throw UnableToReadFile::fromLocation($path, $exception->getMessage(), $exception);
}
}
public function delete(string $path): void
{
$location = $this->encodePath($this->prefixer->prefixPath($path));
try {
$response = $this->client->request('DELETE', $location);
$statusCode = $response['statusCode'];
if ($statusCode !== 404 && ($statusCode < 200 || $statusCode >= 300)) {
throw new RuntimeException('Unexpected status code received while deleting file: ' . $statusCode);
}
} catch (Throwable $exception) {
if ( ! ($exception instanceof ClientHttpException && $exception->getCode() === 404)) {
throw UnableToDeleteFile::atLocation($path, $exception->getMessage(), $exception);
}
}
}
public function deleteDirectory(string $path): void
{
$location = $this->encodePath($this->prefixer->prefixDirectoryPath($path));
try {
$statusCode = $this->client->request('DELETE', $location)['statusCode'];
if ($statusCode !== 404 && ($statusCode < 200 || $statusCode >= 300)) {
throw new RuntimeException('Unexpected status code received while deleting file: ' . $statusCode);
}View on GitHub (pinned to b277b5dc3d)
When it happens
Trigger: Thrown at src/WebDAV/WebDAVAdapter.php:186 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/117c5a9689f5015d.
Report an issue: GitHub.