{"record":{"id":"01d0b8f0b4e53297","repo":"Seldaek/monolog","slug":"there-is-no-existing-directory-at-s-and-it-coul","errorCode":null,"errorMessage":"There is no existing directory at \"%s\" and it could not be created: {}","messagePattern":"There is no existing directory at \"(.+?)\" and it could not be created: (.+?)","errorType":"exception","errorClass":"UnexpectedValueException","httpStatus":null,"severity":"error","filePath":"src/Monolog/Handler/StreamHandler.php","lineNumber":282,"sourceCode":"    private function createDir(string $url): void\n    {\n        // Do not try to create dir if it has already been tried.\n        if (true === $this->dirCreated) {\n            return;\n        }\n\n        $dir = $this->getDirFromStream($url);\n        if (null !== $dir && !is_dir($dir)) {\n            $this->errorMessage = null;\n            // forwarding to $this->customErrorHandler using a closure to make the\n            // private method accessible, see https://github.com/Seldaek/monolog/issues/1866\n            set_error_handler(function (int $code, string $msg) {\n                return $this->customErrorHandler($code, $msg);\n            });\n            $status = mkdir($dir, 0777, true);\n            restore_error_handler();\n            if (false === $status && !is_dir($dir) && strpos((string) $this->errorMessage, 'File exists') === false) {\n                throw new \\UnexpectedValueException(sprintf('There is no existing directory at \"%s\" and it could not be created: '.$this->errorMessage, $dir));\n            }\n        }\n        $this->dirCreated = true;\n    }\n\n    private function getInodeFromUrl(): ?int\n    {\n        if ($this->url === null || str_starts_with($this->url, 'php://')) {\n            return null;\n        }\n\n        $inode = @fileinode($this->url);\n\n        return $inode === false ? null : $inode;\n    }\n\n    private function hasUrlInodeWasChanged(): bool\n    {","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/Seldaek/monolog/blob/57eb1028342134e701e77c617565d51b6e5a2a53/src/Monolog/Handler/StreamHandler.php#L264-L300","documentation":"Error \"There is no existing directory at \"%s\" and it could not be created: {}\" thrown in Seldaek/monolog.","triggerScenarios":"Thrown at src/Monolog/Handler/StreamHandler.php:282 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":"57eb1028342134e701e77c617565d51b6e5a2a53","analyzedAt":"2026-08-17T02:36:30.259Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}