{"record":{"id":"43155b808ccd5a13","repo":"symfony/symfony","slug":"the-importmap-entry-s-must-have-either-a-path","errorCode":null,"errorMessage":"The importmap entry \"%s\" must have either a \"path\" or \"version\" option.","messagePattern":"The importmap entry \"(.+?)\" must have either a \"path\" or \"version\" option\\.","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"src/Symfony/Component/AssetMapper/ImportMap/ImportMapConfigReader.php","lineNumber":75,"sourceCode":"            $isEntrypoint = $data['entrypoint'] ?? false;\n\n            if (isset($data['path'])) {\n                if (isset($data['version'])) {\n                    throw new RuntimeException(\\sprintf('The importmap entry \"%s\" cannot have both a \"path\" and \"version\" option.', $importName));\n                }\n                if (isset($data['package_specifier'])) {\n                    throw new RuntimeException(\\sprintf('The importmap entry \"%s\" cannot have both a \"path\" and \"package_specifier\" option.', $importName));\n                }\n\n                $entries->add(ImportMapEntry::createLocal($importName, $type, $data['path'], $isEntrypoint));\n\n                continue;\n            }\n\n            $version = $data['version'] ?? null;\n\n            if (null === $version) {\n                throw new RuntimeException(\\sprintf('The importmap entry \"%s\" must have either a \"path\" or \"version\" option.', $importName));\n            }\n\n            $packageModuleSpecifier = $data['package_specifier'] ?? $importName;\n            $entries->add($this->createRemoteEntry($importName, $type, $version, $packageModuleSpecifier, $isEntrypoint, $data['esm'] ?? true));\n        }\n\n        return $this->rootImportMapEntries = $entries;\n    }\n\n    public function writeEntries(ImportMapEntries $entries): void\n    {\n        $this->rootImportMapEntries = $entries;\n\n        $importMapConfig = [];\n        foreach ($entries as $entry) {\n            $config = [];\n            if ($entry->isRemotePackage()) {\n                $config['version'] = $entry->version;","sourceCodeStart":57,"sourceCodeEnd":93,"githubUrl":"https://github.com/symfony/symfony/blob/698e28026c22cf35d032cdb6e800db48b1535790/src/Symfony/Component/AssetMapper/ImportMap/ImportMapConfigReader.php#L57-L93","documentation":"Every importmap entry needs a source: 'path' for a local file or 'version' for a remote package. If an entry has neither (only auxiliary keys like 'type' or 'entrypoint'), ImportMapConfigReader throws RuntimeException because it cannot determine where the module comes from.","triggerScenarios":"An entry like ['type' => 'js', 'entrypoint' => true] with neither path nor version; the fallback check at lines 72-75 throws.","commonSituations":"Partially editing an entry and deleting the path/version line by accident; hand-authoring a new entry and forgetting the source key.","solutions":["Add a 'path' (local file) or a 'version' (remote package) to the entry.","If the entry is no longer needed, remove it entirely."],"exampleFix":"// before: no source\n'app' => ['type' => 'js', 'entrypoint' => true],\n\n// after: local source provided\n'app' => ['path' => './app.js', 'type' => 'js', 'entrypoint' => true],","handlingStrategy":"validation","validationCode":"// Ensure every entry has exactly one source key.\nforeach ($config as $name => $data) {\n    if (!isset($data['path']) && !isset($data['version'])) {\n        throw new \\InvalidArgumentException(\"Entry '$name' must have either 'path' or 'version'.\");\n    }\n}","typeGuard":"function entryHasSource(array $data): bool\n{\n    return isset($data['path']) || isset($data['version']);\n}","tryCatchPattern":null,"preventionTips":["When adding an entry, always provide a path (local) or version (remote).","Remove entries entirely rather than leaving sourceless stubs."],"tags":["asset-mapper","importmap","configuration"],"analyzedSha":"698e28026c22cf35d032cdb6e800db48b1535790","analyzedAt":"2026-08-06T23:40:49.025Z","schemaVersion":2},"datasetVersion":"2026-08-07T03:17:09.362Z"}