{"record":{"id":"2144a717c207cba1","repo":"cilium/cilium","slug":"loading-pinned-map-s-w","errorCode":null,"errorMessage":"loading pinned map %s: %w","messagePattern":"loading pinned map (.+?): %w","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/bpf/map_linux.go","lineNumber":682,"sourceCode":"\n\treturn m.open()\n}\n\n// open opens the BPF map. It is identical to Open() but should be used when\n// m.lock is already held. open() may only be used if m.lock is held for\n// writing.\nfunc (m *Map) open() error {\n\tif m.m != nil {\n\t\treturn nil\n\t}\n\n\tif err := m.setPathIfUnset(); err != nil {\n\t\treturn err\n\t}\n\n\tem, err := ebpf.LoadPinnedMap(m.path, nil)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"loading pinned map %s: %w\", m.path, err)\n\t}\n\n\tm.m = em\n\n\tm.updateMetrics()\n\tregisterMap(m.Logger, m.path, m)\n\n\treturn nil\n}\n\nfunc (m *Map) Close() error {\n\tm.lock.Lock()\n\tdefer m.lock.Unlock()\n\n\tif m.enableSync {\n\t\tmapControllers.RemoveController(m.controllerName())\n\t}\n","sourceCodeStart":664,"sourceCodeEnd":700,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/pkg/bpf/map_linux.go#L664-L700","documentation":"open() loads the map pinned at the bpffs path with ebpf.LoadPinnedMap and wraps any failure. The map file does not exist at the path, is not a valid BPF map pin, or the process lacks permission to open it. Callers like Update/Delete/ClearAll go through this open path implicitly, so a missing pin surfaces here.","triggerScenarios":"Map.Open(), Update(), Delete(), DeleteAll(), ClearAll() or resolveErrors() when the map was never created/pinned at m.path, the pin path changed between runs, or the path holds a different object type (e.g. a pinned program).","commonSituations":"Fresh node where the pinning process hasn't run yet; bpffs not mounted at the expected directory; path mismatch after config change or image upgrade; pin removed by a concurrent cleanup while map metadata still references it.","solutions":["Create/open-and-pin the map first (OpenOrCreate/Recreate) before calling Open or dependent ops like Update/Delete","Verify the pin exists: ls -l at m.path and confirm the bpffs mount is active","Check the configured path matches the one used at pin time (no config drift between versions)","Run with enough privileges to open pins under /sys/fs/bpf"],"exampleFix":"// before\nm := bpf.NewMap(logger, \"drops\", \"/sys/fs/bpf/drops\", spec, val)\nm.Update(key, val) // fails: loading pinned map /sys/fs/bpf/drops: no such file or directory\n// after\nif err := m.OpenOrCreate(); err != nil { return err }\nm.Update(key, val)","handlingStrategy":"fallback","validationCode":"if _, err := os.Stat(path); errors.Is(err, fs.ErrNotExist) {\n    // pin missing: create it first via OpenOrCreate before Update/Delete\n}\nif err := exec.Command(\"mountpoint\", \"-q\", \"/sys/fs/bpf\").Run(); err != nil {\n    // bpffs not mounted\n}","typeGuard":null,"tryCatchPattern":"if err := m.Open(); err != nil {\n    if errors.Is(err, fs.ErrNotExist) {\n        if err := m.OpenOrCreate(); err != nil { return err } // fallback: create+pin\n        return nil\n    }\n    return fmt.Errorf(\"loading pinned map: %w\", err)\n}","preventionTips":["Pin maps at startup before any read/update paths run","Keep pin paths in one shared constant/config to prevent drift","Verify bpffs is mounted in entrypoint/systemd setup","On fresh nodes, always prefer OpenOrCreate over Open"],"tags":["ebpf","pinning","bpf-fs","missing-file"],"backgroundTag":"bpf-map-pin-not-found","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}