{"record":{"id":"b823bbbe839f3638","repo":"getgrav/grav","slug":"error-can-not-open-file","errorCode":null,"errorMessage":"Error - can not open file.","messagePattern":"Error - can not open file\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"system/src/Grav/Common/Utils.php","lineNumber":791,"sourceCode":"            /* output the file itself */\n            $chunksize = $bytes * 8; //you may want to change this\n            $bytes_send = 0;\n\n            $fp = @fopen($file, 'rb');\n            if ($fp) {\n                if ($range) {\n                    fseek($fp, $range);\n                }\n                while (!feof($fp) && (!connection_aborted()) && ($bytes_send < $new_length)) {\n                    $buffer = fread($fp, $chunksize);\n                    echo($buffer); //echo($buffer); // is also possible\n                    flush();\n                    usleep($sec * 1000000);\n                    $bytes_send += strlen($buffer);\n                }\n                fclose($fp);\n            } else {\n                throw new RuntimeException('Error - can not open file.');\n            }\n\n            exit;\n        }\n    }\n\n    /**\n     * Returns the output render format, usually the extension provided in the URL. (e.g. `html`, `json`, `xml`, etc).\n     *\n     * @return string\n     */\n    public static function getPageFormat(): string\n    {\n        /** @var Uri $uri */\n        $uri = Grav::instance()['uri'];\n\n        // Set from uri extension\n        $uri_extension = $uri->extension();","sourceCodeStart":773,"sourceCodeEnd":809,"githubUrl":"https://github.com/getgrav/grav/blob/6040efed04efa69b8209448ed81308e7c24147c2/system/src/Grav/Common/Utils.php#L773-L809","documentation":"Error \"Error - can not open file.\" thrown in getgrav/grav.","triggerScenarios":"Thrown at system/src/Grav/Common/Utils.php:791 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":"6040efed04efa69b8209448ed81308e7c24147c2","analyzedAt":"2026-08-17T05:07:31.593Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}