symfony/symfony · error · InvalidArgumentException

The entry "%s" is not a remote package.

Error message

The entry "%s" is not a remote package.

What it means

RemotePackageStorage::isDownloaded() checks whether a remote package's file exists on disk and throws this InvalidArgumentException if the given ImportMapEntry is not a remote package (i.e. its version is null, meaning it is a local/path-based entry). Only remote entries have a downloadable artifact; local entries have no vendor file to check.

Source

Thrown at src/Symfony/Component/AssetMapper/ImportMap/RemotePackageStorage.php:38

 */
class RemotePackageStorage
{
    private readonly Filesystem $filesystem;

    public function __construct(private readonly string $vendorDir)
    {
        $this->filesystem = new Filesystem();
    }

    public function getStorageDir(): string
    {
        return $this->vendorDir;
    }

    public function isDownloaded(ImportMapEntry $entry): bool
    {
        if (!$entry->isRemotePackage()) {
            throw new \InvalidArgumentException(\sprintf('The entry "%s" is not a remote package.', $entry->importName));
        }

        return is_file($this->getDownloadPath($entry->packageModuleSpecifier, $entry->type));
    }

    public function isExtraFileDownloaded(ImportMapEntry $entry, string $extraFilename): bool
    {
        if (!$entry->isRemotePackage()) {
            throw new \InvalidArgumentException(\sprintf('The entry "%s" is not a remote package.', $entry->importName));
        }

        return is_file($this->getExtraFileDownloadPath($entry, $extraFilename));
    }

    public function save(ImportMapEntry $entry, string $contents): void
    {
        if (!$entry->isRemotePackage()) {
            throw new \InvalidArgumentException(\sprintf('The entry "%s" is not a remote package.', $entry->importName));

View on GitHub (pinned to 698e28026c)

Solutions

  1. Guard every call with: if ($entry->isRemotePackage()) { $storage->isDownloaded($entry); }
  2. Filter your entry list to remote packages before passing to storage: array_filter($entries, fn($e) => $e->isRemotePackage()).

Example fix

// before
foreach ($entries as $entry) {
    $storage->isDownloaded($entry);
}
// after
foreach ($entries as $entry) {
    if ($entry->isRemotePackage()) {
        $storage->isDownloaded($entry);
    }
}
Defensive patterns

Strategy: type-guard

Type guard

if ($entry->isRemotePackage()) {
    $exists = $storage->isDownloaded($entry);
}

Prevention

When it happens

Trigger: Passing a local/path-based ImportMapEntry (one created without a version) to isDownloaded(). This usually stems from a bug in calling code that didn't filter entries by isRemotePackage() first.

Common situations: Custom code iterating all import-map entries and calling storage methods without first checking entry->isRemotePackage(). Refactoring that accidentally routes local entries into remote-storage code paths.

Related errors


AI-assisted analysis of symfony/symfony@698e28026c (2026-08-06). Data as JSON: /api/errors/ba1657ade2fdd80a. Report an issue: GitHub.