symfony/http-kernel · error · RuntimeException
Please check your configuration. You are trying to use…
Error message
Please check your configuration. You are trying to use FileStorage with an invalid dsn "%s". The expected format is "file:/path/to/the/storage/folder".
What it means
FileProfilerStorage stores profiler data on disk and requires a DSN of the form file:/path/to/folder. The constructor validates the DSN prefix and throws this RuntimeException when it does not start with 'file:', because there is no way to derive the storage folder.
Solutions
- Set the DSN to a file: URL, e.g. '%kernel.cache_dir%/profiler' → dsn: 'file:%kernel.cache_dir%/profiler'
- Check the profiler DSN env var actually resolves to a file: scheme
- Ensure the folder part points to a creatable directory
Example fix
// before
framework:
profiler:
dsn: 'sqlite:%kernel.cache_dir%/profiler.db'
// after
framework:
profiler:
dsn: 'file:%kernel.cache_dir%/profiler' Defensive patterns
Strategy: validation
Validate before calling
if (!str_starts_with($dsn, 'file:')) {
throw new \RuntimeException("Profiler dsn '$dsn' invalid; expected file:/path/to/folder");
}
$storage = new FileProfilerStorage($dsn); Try / catch
try {
$storage = new FileProfilerStorage($dsn);
} catch (\RuntimeException $e) {
$logger->error('Profiler storage misconfigured: '.$e->getMessage());
$storage = new FileProfilerStorage('file:'.$kernel->getCacheDir().'/profiler');
} Prevention
- Use the file: scheme in framework.profiler.dsn
- Avoid hardcoding other backends' DSNs for file storage
- Document the expected env var value (FILE_PROFILER_DSN=file:...) in .env.example
When it happens
Trigger: Configuring the profiler storage DSN (framework.profiler.dsn or profiler storage service) with a wrong scheme like 'mysql:...', 'sqlite:...', a bare path, or an empty string.
Common situations: Copying a DSN from another storage backend (Doctrine/Redis profilers) into file storage config; default config left invalid after removing an env var; typos like 'file://relative/path' handled elsewhere.
Understand the failure class
Background: "Invalid URL" errors: why new URL(), URI.parse, and reqwest::Url reject your string — missing scheme, whitespace, and bad path format — this error's family across 39 libraries.
Related errors
- Invalid regular expression in the "$
- The trusted header " " is not supported.
- Unable to create the storage directory
- The profiler token " " is invalid: only letters, digits…
- Collector " " does not exist.
AI-assisted analysis of symfony/http-kernel@aa3a39d728 (2026-09-13).
Data as JSON: /api/errors/52b771362fdcaafc.
Report an issue: GitHub.
Appendix: source
Thrown at Profiler/FileProfilerStorage.php:36
*/
class FileProfilerStorage implements ProfilerStorageInterface
{
/**
* Folder where profiler data are stored.
*/
private string $folder;
/**
* Constructs the file storage using a "dsn-like" path.
*
* Example : "file:/path/to/the/storage/folder"
*
* @throws \RuntimeException
*/
public function __construct(string $dsn)
{
if (!str_starts_with($dsn, 'file:')) {
throw new \RuntimeException(\sprintf('Please check your configuration. You are trying to use FileStorage with an invalid dsn "%s". The expected format is "file:/path/to/the/storage/folder".', $dsn));
}
$this->folder = substr($dsn, 5);
if (!is_dir($this->folder) && !@mkdir($this->folder, 0o777, true) && !is_dir($this->folder)) {
throw new \RuntimeException(\sprintf('Unable to create the storage directory (%s).', $this->folder));
}
}
/**
* @param-immediately-invoked-callable $filter
*/
public function find(?string $ip, ?string $url, ?int $limit, ?string $method, ?int $start = null, ?int $end = null, ?string $statusCode = null, ?\Closure $filter = null): array
{
$file = $this->getIndexFilename();
if (!file_exists($file)) {
return [];
}View on GitHub (pinned to aa3a39d728)