Seldaek/monolog · error · UnexpectedValueException

Failed setting chunk size with stream_set_chunk_size()

Error message

Failed setting chunk size with stream_set_chunk_size()

What it means

Error "Failed setting chunk size with stream_set_chunk_size()" thrown in Seldaek/monolog.

Source

Thrown at src/Monolog/Handler/SocketHandler.php:379

            $resource = $this->fsockopen();
        }
        if (\is_bool($resource)) {
            throw new \UnexpectedValueException("Failed connecting to $this->connectionString ($this->errno: $this->errstr)");
        }
        $this->resource = $resource;
    }

    private function setSocketTimeout(): void
    {
        if (!$this->streamSetTimeout()) {
            throw new \UnexpectedValueException("Failed setting timeout with stream_set_timeout()");
        }
    }

    private function setStreamChunkSize(): void
    {
        if (null !== $this->chunkSize && false === $this->streamSetChunkSize()) {
            throw new \UnexpectedValueException("Failed setting chunk size with stream_set_chunk_size()");
        }
    }

    private function writeToSocket(string $data): void
    {
        $length = \strlen($data);
        $sent = 0;
        $this->lastSentBytes = $sent;
        while ($this->isConnected() && $sent < $length) {
            if (0 === $sent) {
                $chunk = $this->fwrite($data);
            } else {
                $chunk = $this->fwrite(substr($data, $sent));
            }
            if ($chunk === false) {
                throw new \RuntimeException("Could not write to socket");
            }
            $sent += $chunk;

View on GitHub (pinned to 57eb102834)

When it happens

Trigger: Thrown at src/Monolog/Handler/SocketHandler.php:379 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of Seldaek/monolog@57eb102834 (2026-08-17). Data as JSON: /api/errors/c1f5a39b14bafa31. Report an issue: GitHub.