getgrav/grav · error · RuntimeException

Page not available for self@ reference: %s

Error message

Page not available for self@ reference: %s

What it means

Error "Page not available for self@ reference: %s" thrown in getgrav/grav.

Source

Thrown at system/src/Grav/Common/Utils.php:1712

     *
     * @param string $path
     * @param FlexObjectInterface|PageInterface|null $object
     * @return string
     * @throws RuntimeException
     */
    public static function getPathFromToken($path, $object = null)
    {
        $matches = static::resolveTokenPath($path);
        if (null === $matches) {
            return $path;
        }

        $grav = Grav::instance();

        switch ($matches[0]) {
            case 'self':
                if (!$object instanceof MediaInterface) {
                    throw new RuntimeException(sprintf('Page not available for self@ reference: %s', $path));
                }

                if ($matches[2] === '') {
                    if ($object->exists()) {
                        $route = '/' . $matches[1];

                        if ($object instanceof PageInterface) {
                            return trim($object->relativePagePath() . $route, '/');
                        }

                        $folder = $object->getMediaFolder();
                        if ($folder) {
                            return trim($folder . $route, '/');
                        }
                    } else {
                        return '';
                    }
                }

View on GitHub (pinned to 6040efed04)

When it happens

Trigger: Thrown at system/src/Grav/Common/Utils.php:1712 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/691497254973907f. Report an issue: GitHub.