{"record":{"id":"9bd1550e43cf308c","repo":"getgrav/grav","slug":"bad-configuration-system-custom-base-url","errorCode":null,"errorMessage":"Bad configuration: system.custom_base_url","messagePattern":"Bad configuration: system\\.custom_base_url","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"system/src/Grav/Common/Uri.php","lineNumber":174,"sourceCode":"        $grav = Grav::instance();\n\n        /** @var Config $config */\n        $config = $grav['config'];\n\n        /** @var Language $language */\n        $language = $grav['language'];\n\n        // add the port to the base for non-standard ports\n        if ($this->port && $config->get('system.reverse_proxy_setup') === false) {\n            $this->base .= ':' . $this->port;\n        }\n\n        // Handle custom base\n        $custom_base = rtrim((string) $grav['config']->get('system.custom_base_url', ''), '/');\n        if ($custom_base) {\n            $custom_parts = parse_url($custom_base);\n            if ($custom_parts === false) {\n                throw new RuntimeException('Bad configuration: system.custom_base_url');\n            }\n            $orig_root_path = $this->root_path;\n            $this->root_path = isset($custom_parts['path']) ? rtrim($custom_parts['path'], '/') : '';\n            if (isset($custom_parts['scheme'])) {\n                $this->base = $custom_parts['scheme'] . '://' . $custom_parts['host'];\n                $this->port = $custom_parts['port'] ?? null;\n                if ($this->port && $config->get('system.reverse_proxy_setup') === false) {\n                    $this->base .= ':' . $this->port;\n                }\n                $this->root = $custom_base;\n            } else {\n                $this->root = $this->base . $this->root_path;\n            }\n            $this->uri = Utils::replaceFirstOccurrence($orig_root_path, $this->root_path, $this->uri);\n        } else {\n            $this->root = $this->base . $this->root_path;\n        }\n        $this->root_url = null;","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/getgrav/grav/blob/6040efed04efa69b8209448ed81308e7c24147c2/system/src/Grav/Common/Uri.php#L156-L192","documentation":"Error \"Bad configuration: system.custom_base_url\" thrown in getgrav/grav.","triggerScenarios":"Thrown at system/src/Grav/Common/Uri.php:174 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"}