{"record":{"id":"acefa04cb5d64126","repo":"Seldaek/monolog","slug":"the-stream-or-file-s-could-not-be-opened-in-app","errorCode":null,"errorMessage":"The stream or file \"%s\" could not be opened in append mode: {}","messagePattern":"The stream or file \"(.+?)\" could not be opened in append mode: (.+?)","errorType":"exception","errorClass":"UnexpectedValueException","httpStatus":null,"severity":"error","filePath":"src/Monolog/Handler/StreamHandler.php","lineNumber":168,"sourceCode":"            $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\n            try {\n                $stream = fopen($url, $this->fileOpenMode);\n                if ($this->filePermission !== null) {\n                    @chmod($url, $this->filePermission);\n                }\n            } finally {\n                restore_error_handler();\n            }\n            if (!\\is_resource($stream)) {\n                $this->stream = null;\n\n                throw new \\UnexpectedValueException(sprintf('The stream or file \"%s\" could not be opened in append mode: '.$this->errorMessage, $url) . Utils::getRecordMessageForException($record));\n            }\n            stream_set_chunk_size($stream, $this->streamChunkSize);\n            $this->stream = $stream;\n            $this->inodeUrl = $this->getInodeFromUrl();\n        }\n\n        $stream = $this->stream;\n        if ($this->useLocking) {\n            // ignoring errors here, there's not much we can do about them\n            flock($stream, LOCK_EX);\n        }\n\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        });","sourceCodeStart":150,"sourceCodeEnd":186,"githubUrl":"https://github.com/Seldaek/monolog/blob/57eb1028342134e701e77c617565d51b6e5a2a53/src/Monolog/Handler/StreamHandler.php#L150-L186","documentation":"Error \"The stream or file \"%s\" could not be opened in append mode: {}\" thrown in Seldaek/monolog.","triggerScenarios":"Thrown at src/Monolog/Handler/StreamHandler.php:168 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"}