{"record":{"id":"6b9099b2e6c58c49","repo":"cilium/cilium","slug":"mapspec-not-found","errorCode":null,"errorMessage":"MapSpec not found","messagePattern":"MapSpec not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/maps/registry/registry.go","lineNumber":24,"sourceCode":"import (\n\t_ \"embed\"\n\t\"errors\"\n\t\"fmt\"\n\t\"log/slog\"\n\n\t\"github.com/cilium/ebpf\"\n\n\t_ \"github.com/cilium/hive/cell\"\n\n\t\"github.com/cilium/cilium/pkg/datapath/maps\"\n\t\"github.com/cilium/cilium/pkg/lock\"\n\t\"github.com/cilium/cilium/pkg/logging/logfields\"\n)\n\nvar (\n\tErrStarted     = errors.New(\"registry has already been started\")\n\tErrNotStarted  = errors.New(\"registry has not yet been started\")\n\tErrMapNotFound = errors.New(\"MapSpec not found\")\n)\n\n// MapRegistry contains [ebpf.MapSpec]s for all pinned maps in the datapath.\n//\n// The registry allows Cells to provide [MapSpecPatch]es during Hive\n// construction, e.g. for changing MaxEntries of a map based on configuration\n// parameters. Only select fields can be modified, see [MapSpecPatch] for\n// details.\n//\n// Once the registry has been started, MapSpecs can only be retrieved but\n// not modified. Any packages which need to create maps at runtime should\n// obtain the MapSpecs from this registry.\ntype MapRegistry struct {\n\tl *slog.Logger\n\n\tmu      lock.Mutex\n\tstarted bool\n","sourceCodeStart":6,"sourceCodeEnd":42,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/pkg/maps/registry/registry.go#L6-L42","documentation":"ErrMapNotFound is a sentinel error of the pkg/maps/registry MapRegistry indicating no [ebpf.MapSpec] is registered under the requested name. It is returned by Get, GetPatch, patchMaps, Modify, and TestMapRegistry when the given map name does not match any registered spec. It signals a name mismatch or a missing cell contribution, not a datapath/pinning failure.","triggerScenarios":"Get(name)/GetPatch(name) with a name not in the registry; Modify() or patchMaps() targeting a MapSpec that no cell provided; TestMapRegistry asserting on an unknown map name.","commonSituations":"Typo or wrong prefix in the map name; a map was removed/renamed in a newer cilium version while external code still patches the old name; a cell providing the MapSpecPatch is not included in the Hive.","solutions":["Verify the exact map name against the MapSpec registrations (compare with errors.Is(err, registry.ErrMapNotFound) and log the requested name).","Register the missing MapSpec or add the cell that contributes it to the Hive.","Update the map name after a cilium upgrade where the map was renamed or deleted.","Use GetPatch only for maps known to exist; check presence with Get first."],"exampleFix":"// before\npatch := reg.GetPatch(\"cilium_ipcache_v2_old\") // ErrMapNotFound after rename\n// after\nspec, err := reg.Get(\"cilium_ipcache\")\nif errors.Is(err, registry.ErrMapNotFound) {\n    return fmt.Errorf(\"map %q not registered; available maps must be contributed by a cell\", \"cilium_ipcache\")\n}","handlingStrategy":"validation","validationCode":"// check presence before patching\nif _, err := reg.Get(mapName); errors.Is(err, registry.ErrMapNotFound) {\n    return fmt.Errorf(\"cannot patch unknown map %q\", mapName)\n}","typeGuard":"func mapExists(r *registry.MapRegistry, name string) bool {\n    _, err := r.Get(name)\n    return !errors.Is(err, registry.ErrMapNotFound)\n}","tryCatchPattern":"patch, err := reg.GetPatch(mapName)\nif errors.Is(err, registry.ErrMapNotFound) {\n    log.Warnf(\"map %q not registered, skipping patch\", mapName)\n    return nil\n}\nif err != nil { return err }","preventionTips":["Keep map names in a shared constants package to avoid typos","After cilium upgrades, verify all patched map names still exist","Ensure the cell contributing the MapSpec is included in the Hive"],"tags":["go","ebpf","lookup","registry"],"backgroundTag":"resource-not-found","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}