{"record":{"id":"32106ee505f437de","repo":"cilium/cilium","slug":"map-q-already-renamed-to-q-conflicts-with-q","errorCode":null,"errorMessage":"map %q already renamed to %q (conflicts with: %q)","messagePattern":"map %q already renamed to %q \\(conflicts with: %q\\)","errorType":"error_code","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/bpf/collection.go","lineNumber":408,"sourceCode":"\n\t\texisting.Close()\n\t}\n\n\treturn nil\n}\n\n// renameMaps applies renames to coll.\nfunc renameMaps(coll *ebpf.CollectionSpec, allRenames []map[string]string) error {\n\talreadyRenamed := make(sets.Set[string])\n\tfor _, renames := range allRenames {\n\t\tfor name, rename := range renames {\n\t\t\tspec := coll.Maps[name]\n\t\t\tif spec == nil {\n\t\t\t\treturn fmt.Errorf(\"unknown map %q: can't rename to %q\", name, rename)\n\t\t\t}\n\n\t\t\tif alreadyRenamed.Has(name) {\n\t\t\t\treturn fmt.Errorf(\"map %q already renamed to %q (conflicts with: %q)\", name, spec.Name, rename)\n\t\t\t}\n\n\t\t\tspec.Name = rename\n\t\t\talreadyRenamed.Insert(name)\n\t\t}\n\t}\n\n\treturn nil\n}\n\n// logFreedMaps checks that no maps were freed by the kernel after loading\n// the given Collection.\n//\n// Only runs in debug mode due to its runtime cost.\nfunc logFreedMaps(logger *slog.Logger, coll *ebpf.Collection, fixed *set.Set[string]) {\n\tif !logger.Enabled(context.TODO(), slog.LevelDebug) {\n\t\treturn\n\t}","sourceCodeStart":390,"sourceCodeEnd":426,"githubUrl":"https://github.com/cilium/cilium/blob/ac7b90affa4baf0642e6685319d56907b3a73a6d/pkg/bpf/collection.go#L390-L426","documentation":"renameMaps tracks already-renamed maps and rejects a rename table that names the same source map twice, returning \"map %q already renamed to %q (conflicts with: %q)\". Duplicate renames are ambiguous, so the library fails fast rather than applying an order-dependent result.","triggerScenarios":"opts.MapRenames containing multiple entries (across the []map[string]string slices) for the same source map name.","commonSituations":"Merging rename tables from several components/features where each adds a rename for the same map; copy-paste duplication in config; two daemon features independently renaming a shared map.","solutions":["Deduplicate opts.MapRenames so each source map appears once.","Decide which component owns the rename and remove the conflicting entry.","Validate rename tables at startup before calling LoadAndAssign."],"exampleFix":"// before\nrenames := []map[string]string{{\"events\": \"a\"}, {\"events\": \"b\"}} // conflict\n// after\nrenames := []map[string]string{{\"events\": \"a\"}} // single rename per map","handlingStrategy":"validation","validationCode":"// Reject duplicate rename sources at config load time\nseen := map[string]bool{}\nfor _, rs := range opts.MapRenames {\n    for name := range rs {\n        if seen[name] {\n            return fmt.Errorf(\"duplicate rename for map %q\", name)\n        }\n        seen[name] = true\n    }\n}","typeGuard":null,"tryCatchPattern":"if err != nil && strings.Contains(err.Error(), \"already renamed\") {\n    return fmt.Errorf(\"conflicting rename config: %w\", err)\n}","preventionTips":["Merge rename tables centrally with dedup instead of concatenating per-feature maps.","Add a startup assertion that each map is renamed at most once."],"tags":["bpf","ebpf","map-rename","config-conflict","cilium"],"backgroundTag":"duplicate-map-rename","analyzedSha":"ac7b90affa4baf0642e6685319d56907b3a73a6d","analyzedAt":"2026-08-31T18:27:15.868Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}