getgrav/grav · error · InvalidArgumentException

A relative URI must not have a path beginning with a segment

Error message

A relative URI must not have a path beginning with a segment containing a colon

What it means

Error "A relative URI must not have a path beginning with a segment containing a colon" thrown in getgrav/grav.

Source

Thrown at system/src/Grav/Framework/Psr7/AbstractUri.php:410

            $this->host === "" &&
            ($this->scheme === "http" || $this->scheme === "https")
        ) {
            throw new InvalidArgumentException(
                "Uri with a scheme must have a host"
            );
        }

        if ($this->getAuthority() === "") {
            if (str_starts_with($this->path, "//")) {
                throw new InvalidArgumentException(
                    'The path of a URI without an authority must not start with two slashes \'//\''
                );
            }
            if (
                $this->scheme === "" &&
                str_contains(explode("/", $this->path, 2)[0], ":")
            ) {
                throw new InvalidArgumentException(
                    "A relative URI must not have a path beginning with a segment containing a colon"
                );
            }
        } elseif (isset($this->path[0]) && $this->path[0] !== "/") {
            throw new InvalidArgumentException(
                'The path of a URI with an authority must start with a slash \'/\' or be empty'
            );
        }
    }

    /**
     * @return bool
     */
    protected function isDefaultPort()
    {
        $scheme = $this->scheme;
        $port = $this->port;

View on GitHub (pinned to 6040efed04)

When it happens

Trigger: Thrown at system/src/Grav/Framework/Psr7/AbstractUri.php:410 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of getgrav/grav@6040efed04 (2026-08-17). Data as JSON: /api/errors/5ba0059c8bb1c181. Report an issue: GitHub.