{"record":{"id":"f5b5f807db4b60ec","repo":"getgrav/grav","slug":"500-f5b5f8","errorCode":"500","errorMessage":"Internal Error","messagePattern":"Internal Error","errorType":"http","errorClass":"RuntimeException","httpStatus":500,"severity":"error","filePath":"system/src/Grav/Installer/Install.php","lineNumber":308,"sourceCode":"        $this->checkVersion($results, 'grav', 'grav', $this->requires['grav'], GRAV_VERSION);\n        $this->checkPlugins($results, $this->requires['plugins']);\n\n        return $results;\n    }\n\n    /**\n     * @return void\n     * @throws RuntimeException\n     */\n    public function prepare(): void\n    {\n        // Locate the new Grav update and the target site from the filesystem.\n        $this->ensureLocation();\n        $location = realpath(__DIR__);\n        $target = realpath(GRAV_ROOT . '/index.php');\n\n        if (!$location) {\n            throw new RuntimeException('Internal Error', 500);\n        }\n\n        if ($target && dirname($location, 4) === dirname($target)) {\n            // We cannot copy files into themselves, abort!\n            throw new RuntimeException('Grav has already been installed here!', 400);\n        }\n\n        // Load the installer classes.\n        foreach ($this->classMap as $class_name => $path) {\n            // Make sure that none of the Grav\\Installer classes have been loaded, otherwise installation may fail!\n            if (class_exists($class_name, false)) {\n                throw new RuntimeException(sprintf('Cannot update Grav, class %s has already been loaded!', $class_name), 500);\n            }\n\n            require $path;\n        }\n\n        $this->legacySupport();","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/getgrav/grav/blob/6040efed04efa69b8209448ed81308e7c24147c2/system/src/Grav/Installer/Install.php#L290-L326","documentation":"During Install::prepare(), Grav resolves its own installer directory with `realpath(__DIR__)`; if that returns false it throws RuntimeException 500 'Internal Error'. realpath() fails when the path cannot be resolved at all — the directory was deleted or replaced mid-run, a symlink loop exists, or a path component lost permissions. It is a defensive environment sanity check and is exceptionally rare.","triggerScenarios":"The system/src/Grav/Installer directory being deleted, moved, or having its symlink chain broken while direct-install runs; a symlink loop in the deployment layout; permissions revoked on a parent directory between process start and the realpath call.","commonSituations":"Deploys that rsync-delete the codebase concurrently with an upgrade; broken symlink-based release directories (capistrano-style layouts pointing at a removed release).","solutions":["Re-run direct-install from a stable, fully-present codebase — the previous attempt was racing a deploy or the tree was incomplete","Check the deployment layout for dangling/looping symlinks around GRAV_ROOT and system/","Verify directory permissions on every path component of the installer directory"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Sanity-check the codebase before invoking the installer\n$installerDir = realpath(GRAV_ROOT . '/system/src/Grav/Installer');\nif ($installerDir === false || !is_dir($installerDir) || !is_readable($installerDir)) {\n    throw new \\RuntimeException('Installer directory missing or unreadable — codebase incomplete');\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Do not run direct-install concurrently with deploys that replace the codebase","Verify release symlinks resolve to existing directories before upgrading","Treat this as an environment integrity signal: re-run from a verified-complete checkout"],"tags":["installer","filesystem","realpath","deployment"],"backgroundTag":"filesystem-path-not-found","analyzedSha":"6040efed04efa69b8209448ed81308e7c24147c2","analyzedAt":"2026-08-17T05:07:31.593Z","schemaVersion":2},"datasetVersion":"2026-08-17T09:17:11.063Z"}