thephpleague/flysystem · error · RuntimeException

MOVE command returned unexpected status code:

Error message

MOVE command returned unexpected status code: 

What it means

Error "MOVE command returned unexpected status code: " thrown in thephpleague/flysystem.

Source

Thrown at src/WebDAV/WebDAVAdapter.php:359

        }

        if ($this->manualMove) {
            $this->manualMove($source, $destination);

            return;
        }

        $this->createParentDirFor($destination);
        $location = $this->encodePath($this->prefixer->prefixPath($source));
        $newLocation = $this->encodePath($this->prefixer->prefixPath($destination));

        try {
            $response = $this->client->request('MOVE', $location, null, [
                'Destination' => $this->client->getAbsoluteUrl($newLocation),
            ]);

            if ($response['statusCode'] < 200 || $response['statusCode'] >= 300) {
                throw new RuntimeException('MOVE command returned unexpected status code: ' . $response['statusCode'] . "\n{$response['body']}");
            }
        } catch (Throwable $e) {
            throw UnableToMoveFile::fromLocationTo($source, $destination, $e);
        }
    }

    private function manualMove(string $source, string $destination): void
    {
        try {
            $handle = $this->readStream($source);
            $this->writeStream($destination, $handle, new Config());
            @fclose($handle);
            $this->delete($source);
        } catch (Throwable $exception) {
            throw UnableToMoveFile::fromLocationTo($source, $destination, $exception);
        }
    }

View on GitHub (pinned to b277b5dc3d)

When it happens

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