slimphp/Slim · error · RuntimeException

Route collector cache file `%s` is not readable

Error message

Route collector cache file `%s` is not readable

What it means

Error "Route collector cache file `%s` is not readable" thrown in slimphp/Slim.

Source

Thrown at Slim/Routing/RouteCollector.php:140

        $this->defaultInvocationStrategy = $strategy;
        return $this;
    }

    /**
     * {@inheritdoc}
     */
    public function getCacheFile(): ?string
    {
        return $this->cacheFile;
    }

    /**
     * {@inheritdoc}
     */
    public function setCacheFile(string $cacheFile): RouteCollectorInterface
    {
        if (file_exists($cacheFile) && !is_readable($cacheFile)) {
            throw new RuntimeException(
                sprintf('Route collector cache file `%s` is not readable', $cacheFile)
            );
        }

        if (!file_exists($cacheFile) && !is_writable(dirname($cacheFile))) {
            throw new RuntimeException(
                sprintf('Route collector cache file directory `%s` is not writable', dirname($cacheFile))
            );
        }

        $this->cacheFile = $cacheFile;
        return $this;
    }

    /**
     * {@inheritdoc}
     */
    public function getBasePath(): string

View on GitHub (pinned to 80900fb39c)

When it happens

Trigger: Thrown at Slim/Routing/RouteCollector.php:140 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of slimphp/Slim@80900fb39c (2026-08-21). Data as JSON: /api/errors/5920169f5513413c. Report an issue: GitHub.