Seldaek/monolog · error · LogicException
Missing stream url, the stream can not be opened. This may b
Error message
Missing stream url, the stream can not be opened. This may be caused by a premature call to close().
What it means
Error "Missing stream url, the stream can not be opened. This may be caused by a premature call to close()." thrown in Seldaek/monolog.
Source
Thrown at src/Monolog/Handler/StreamHandler.php:147
return $this->streamChunkSize;
}
/**
* @inheritDoc
*/
protected function write(LogRecord $record): void
{
if ($this->hasUrlInodeWasChanged()) {
$this->close();
$this->write($record);
return;
}
if (!\is_resource($this->stream)) {
$url = $this->url;
if (null === $url || '' === $url) {
throw new \LogicException('Missing stream url, the stream can not be opened. This may be caused by a premature call to close().' . Utils::getRecordMessageForException($record));
}
$this->createDir($url);
$this->errorMessage = null;
// forwarding to $this->customErrorHandler using a closure to make the
// private method accessible, see https://github.com/Seldaek/monolog/issues/1866
set_error_handler(function (int $code, string $msg) {
return $this->customErrorHandler($code, $msg);
});
try {
$stream = fopen($url, $this->fileOpenMode);
if ($this->filePermission !== null) {
@chmod($url, $this->filePermission);
}
} finally {
restore_error_handler();
}
if (!\is_resource($stream)) {View on GitHub (pinned to 57eb102834)
When it happens
Trigger: Thrown at src/Monolog/Handler/StreamHandler.php:147 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/45482ebaa8da7347.
Report an issue: GitHub.