{"record":{"id":"117c5a9689f5015d","repo":"thephpleague/flysystem","slug":"unexpected-status-code-received-while-deleting-fil","errorCode":null,"errorMessage":"Unexpected status code received while deleting file: ","messagePattern":"Unexpected status code received while deleting file: ","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/WebDAV/WebDAVAdapter.php","lineNumber":186,"sourceCode":"                throw new RuntimeException('Unexpected response code for GET: ' . $status);\n            }\n\n            return $response->getBodyAsStream();\n        } catch (Throwable $exception) {\n            throw UnableToReadFile::fromLocation($path, $exception->getMessage(), $exception);\n        }\n    }\n\n    public function delete(string $path): void\n    {\n        $location = $this->encodePath($this->prefixer->prefixPath($path));\n\n        try {\n            $response = $this->client->request('DELETE', $location);\n            $statusCode = $response['statusCode'];\n\n            if ($statusCode !== 404 && ($statusCode < 200 || $statusCode >= 300)) {\n                throw new RuntimeException('Unexpected status code received while deleting file: ' . $statusCode);\n            }\n        } catch (Throwable $exception) {\n            if ( ! ($exception instanceof ClientHttpException && $exception->getCode() === 404)) {\n                throw UnableToDeleteFile::atLocation($path, $exception->getMessage(), $exception);\n            }\n        }\n    }\n\n    public function deleteDirectory(string $path): void\n    {\n        $location = $this->encodePath($this->prefixer->prefixDirectoryPath($path));\n\n        try {\n            $statusCode = $this->client->request('DELETE', $location)['statusCode'];\n\n            if ($statusCode !== 404 && ($statusCode < 200 || $statusCode >= 300)) {\n                throw new RuntimeException('Unexpected status code received while deleting file: ' . $statusCode);\n            }","sourceCodeStart":168,"sourceCodeEnd":204,"githubUrl":"https://github.com/thephpleague/flysystem/blob/b277b5dc3d56650b68904117124e79c851e12376/src/WebDAV/WebDAVAdapter.php#L168-L204","documentation":"Error \"Unexpected status code received while deleting file: \" thrown in thephpleague/flysystem.","triggerScenarios":"Thrown at src/WebDAV/WebDAVAdapter.php:186 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"}