symfony/symfony · error · InvalidArgumentException
The path "%s" of the entrypoint "%s" mentioned in "importmap
Error message
The path "%s" of the entrypoint "%s" mentioned in "importmap.php" cannot be found in any asset map paths.
What it means
ImportMapGenerator::findEagerEntrypointImports() resolves the entrypoint's 'path' via findAsset(); if neither assetMapper->getAsset() nor getAssetFromSourcePath() finds it, InvalidArgumentException reports the path is not in any asset map path. The entrypoint exists and is flagged correctly but its file is unreachable from configured asset_mapper.paths.
Source
Thrown at src/Symfony/Component/AssetMapper/ImportMap/ImportMapGenerator.php:153
return $this->compiledConfigReader->loadConfig(\sprintf(self::ENTRYPOINT_CACHE_FILENAME_PATTERN, $entryName));
}
$rootImportEntries = $this->importMapConfigReader->getEntries();
if (!$rootImportEntries->has($entryName)) {
throw new \InvalidArgumentException(\sprintf('The entrypoint "%s" does not exist in "importmap.php".', $entryName));
}
if (!$rootImportEntries->get($entryName)->isEntrypoint) {
throw new \InvalidArgumentException(\sprintf('The entrypoint "%s" is not an entry point in "importmap.php". Set "entrypoint" => true to make it available as an entrypoint.', $entryName));
}
if ($rootImportEntries->get($entryName)->isRemotePackage()) {
throw new \InvalidArgumentException(\sprintf('The entrypoint "%s" is a remote package and cannot be used as an entrypoint.', $entryName));
}
$asset = $this->findAsset($rootImportEntries->get($entryName)->path);
if (!$asset) {
throw new \InvalidArgumentException(\sprintf('The path "%s" of the entrypoint "%s" mentioned in "importmap.php" cannot be found in any asset map paths.', $rootImportEntries->get($entryName)->path, $entryName));
}
return $this->findEagerImports($asset);
}
/**
* Adds "implicit" entries to the importmap.
*
* This recursively searches the dependencies of the given entry
* (i.e. it looks for modules imported from other modules)
* and adds them to the importmap.
*
* @param array<string, ImportMapEntry> $currentImportEntries
* @param array<string, MappedAsset> $resolvedAssets Filled with the asset of each expanded entry
*
* @return array<string, ImportMapEntry>
*/
private function addImplicitEntries(ImportMapEntry $entry, array $currentImportEntries, array &$resolvedAssets): arrayView on GitHub (pinned to 698e28026c)
Solutions
- Add the directory containing the entrypoint file to framework.asset_mapper.paths in asset_mapper.yaml.
- Correct the 'path' in importmap.php to point where the file actually lives (relative paths resolve against the importmap.php directory).
- Run bin/console debug:asset-map to see which logical paths the mapper actually indexes.
- Re-require with the correct logical path: bin/console importmap:require app=./assets/app.js --entrypoint.
Example fix
# config/packages/asset_mapper.yaml - before
framework:
asset_mapper:
paths: [] # 'assets' not mapped
# importmap.php: 'app' => ['path' => './assets/app.js', 'entrypoint' => true]
# after
framework:
asset_mapper:
paths:
- '%kernel.project_dir%/assets' Defensive patterns
Strategy: validation
Validate before calling
// Confirm the entrypoint's path resolves in the asset mapper before compiling.
$asset = $assetMapper->getAsset($entry->path)
?? $assetMapper->getAssetFromSourcePath($reader->convertPathToFilesystemPath($entry->path));
if (null === $asset) {
throw new \RuntimeException('Entrypoint path '.$entry->path.' is not mapped');
} Type guard
function entrypointPathResolves(AssetMapperInterface $m, ImportMapConfigReader $r, string $name): bool {
$e = $r->getEntries()->get($name);
return null !== ($m->getAsset($e->path)
?? $m->getAssetFromSourcePath($r->convertPathToFilesystemPath($e->path)));
} Try / catch
try {
$imports = $generator->findEagerEntrypointImports($name);
} catch (\InvalidArgumentException $e) {
if (str_contains($e->getMessage(), 'cannot be found in any asset map paths')) {
// add the dir to asset_mapper.paths or fix the path
} else { throw $e; }
} Prevention
- Keep entrypoint files under directories listed in framework.asset_mapper.paths.
- Run bin/console debug:asset-map to verify the logical path resolves.
- Re-run importmap:require after moving entrypoint files.
When it happens
Trigger: An entrypoint in importmap.php points to './assets/app.js' but 'assets' is not in asset_mapper.paths; the file was moved/deleted; the path is relative to a different root than importmap.php's directory; a typo in the path.
Common situations: Frontend restructure moved files out of a mapped directory; asset_mapper.paths was trimmed but importmap.php still references the old location; relative path computed against the wrong root.
Related errors
- The entrypoint "%s" does not exist in "importmap.php".
- The entrypoint "%s" is not an entry point in "importmap.php"
- The entrypoint "%s" is a remote package and cannot be used a
- The path "%s" of the package "%s" cannot be found: either pa
- The asset mapper directory "%s" does not exist.
AI-assisted analysis of symfony/symfony@698e28026c (2026-08-06).
Data as JSON: /api/errors/ba3d34278cdf028f.
Report an issue: GitHub.