{"record":{"id":"f54aab214def1dc2","repo":"OpenNHP/opennhp","slug":"events-map-not-found","errorCode":null,"errorMessage":"'events' map not found","messagePattern":"'events' map not found","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"endpoints/ac/ebpf/ebpfegine.go","lineNumber":175,"sourceCode":"\t\tlog.Error(\"failed to attach XDP program to interface: %s\", ifaceName)\n\t\treturn err\n\t}\n\t//load tc eBPF tc_egress.o to net interface which default route exit\n\ttcLink, err = link.AttachTCX(link.TCXOptions{\n\t\tProgram:   tcObjs.TcEgressProg,\n\t\tInterface: iface.Index,\n\t\tAttach:    ebpf.AttachTCXEgress,\n\t})\n\tif err != nil {\n\t\tlog.Error(\"failed to attach TC egress program to interface: %s\", ifaceName)\n\t\treturn err\n\t}\n\n\t// Accessing the Perf Buffer Map named \"events\" defined in eBPF.\n\teventsMap := objs.Events\n\tif eventsMap == nil {\n\t\tlog.Error(\"failed to load 'events' map from eBPF object (nil)\")\n\t\treturn fmt.Errorf(\"'events' map not found\")\n\t}\n\n\tExeDirPath := dirPath\n\t//Set up the DENY logger\n\tDenyLogger = log.NewLoggerDefine(\n\t\t\"\",\n\t\tlogLevel,\n\t\tfilepath.Join(ExeDirPath, \"logs\"),\n\t\t\"nhp_deny\",\n\t)\n\tDenyLogger.SetFlags(stdlog.Lmsgprefix)\n\t// Set up the ACCEPT logger\n\tAcLogger = log.NewLoggerDefine(\n\t\t\"\",\n\t\tlogLevel,\n\t\tfilepath.Join(ExeDirPath, \"logs\"),\n\t\t\"nhp_accept\",\n\t)","sourceCodeStart":157,"sourceCodeEnd":193,"githubUrl":"https://github.com/OpenNHP/opennhp/blob/6e04ca5ff03222a699c24205cd4bf8fee9af7ffe/endpoints/ac/ebpf/ebpfegine.go#L157-L193","documentation":"EbpfEngineLoad returns \"'events' map not found\" when the loaded eBPF object's perf-event map named 'events' (objs.Events from the generated bpf skeleton) is nil after ebpf.LoadPinnedObjects/CollectionSpec load. Without this map the engine cannot receive deny events from the kernel XDP program, so startup is aborted.","triggerScenarios":"The pinned/compiled eBPF object at dirPath does not define the 'events' perf map (stale or wrong .o file), or skeleton loading partially failed leaving objs.Events nil (section name mismatch between C source and Go skeleton).","commonSituations":"eBPF C sources were edited to rename the events map but the Go skeleton (bpf headers) was not regenerated; deploying an old object file from a different build; make ebpf skipped so an incompatible object is present.","solutions":["Regenerate eBPF objects and Go skeletons (make ebpf with clang) so the 'events' map exists and matches the skeleton","Verify the object file at dirPath is current and defines the 'events' perf map (bpftool map dump / llvm-objdump)","Check load errors before this check — the bpf loader usually logs the underlying failure that left Events nil","Ensure the running kernel supports the map/program types used by the object"],"exampleFix":"// before\neventsMap := objs.Events\nif eventsMap == nil {\n\treturn fmt.Errorf(\"'events' map not found\")\n}\n// after\nif err := objs.Load(); err != nil { // or check spec.HasMap(\"events\")\n\treturn fmt.Errorf(\"load eBPF objects: %w\", err)\n}\neventsMap := objs.Events\nif eventsMap == nil {\n\treturn fmt.Errorf(\"'events' map missing from object (regenerate with make ebpf)\")\n}","handlingStrategy":"validation","validationCode":"// before load\nspec, err := ebpf.LoadCollectionSpec(objPath)\nif err != nil { return err }\nif _, ok := spec.Maps[\"events\"]; !ok {\n\treturn fmt.Errorf(\"object %s lacks 'events' map; rebuild with make ebpf\", objPath)\n}","typeGuard":null,"tryCatchPattern":"eventsMap := objs.Events\nif eventsMap == nil {\n\treturn fmt.Errorf(\"'events' map nil; underlying load err: %w\", loadErr)\n}","preventionTips":["Always regenerate skeletons when eBPF C sources change","Pin object file versions alongside binary builds","Check bpf loader errors before dereferencing skeleton fields"],"tags":["ebpf","bpf-map","xdp","kernel"],"backgroundTag":"resource-not-found","analyzedSha":"6e04ca5ff03222a699c24205cd4bf8fee9af7ffe","analyzedAt":"2026-09-07T15:44:59.941Z","contentChangedAt":"2026-09-07T15:44:59.941Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}