cilium/cilium · error

map %q already renamed to %q (conflicts with: %q)

Error message

map %q already renamed to %q (conflicts with: %q)

What it means

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.

Source

Thrown at pkg/bpf/collection.go:408

		existing.Close()
	}

	return nil
}

// renameMaps applies renames to coll.
func renameMaps(coll *ebpf.CollectionSpec, allRenames []map[string]string) error {
	alreadyRenamed := make(sets.Set[string])
	for _, renames := range allRenames {
		for name, rename := range renames {
			spec := coll.Maps[name]
			if spec == nil {
				return fmt.Errorf("unknown map %q: can't rename to %q", name, rename)
			}

			if alreadyRenamed.Has(name) {
				return fmt.Errorf("map %q already renamed to %q (conflicts with: %q)", name, spec.Name, rename)
			}

			spec.Name = rename
			alreadyRenamed.Insert(name)
		}
	}

	return nil
}

// logFreedMaps checks that no maps were freed by the kernel after loading
// the given Collection.
//
// Only runs in debug mode due to its runtime cost.
func logFreedMaps(logger *slog.Logger, coll *ebpf.Collection, fixed *set.Set[string]) {
	if !logger.Enabled(context.TODO(), slog.LevelDebug) {
		return
	}

View on GitHub (pinned to ac7b90affa)

Solutions

  1. Deduplicate opts.MapRenames so each source map appears once.
  2. Decide which component owns the rename and remove the conflicting entry.
  3. Validate rename tables at startup before calling LoadAndAssign.

Example fix

// before
renames := []map[string]string{{"events": "a"}, {"events": "b"}} // conflict
// after
renames := []map[string]string{{"events": "a"}} // single rename per map
Defensive patterns

Strategy: validation

Validate before calling

// Reject duplicate rename sources at config load time
seen := map[string]bool{}
for _, rs := range opts.MapRenames {
    for name := range rs {
        if seen[name] {
            return fmt.Errorf("duplicate rename for map %q", name)
        }
        seen[name] = true
    }
}

Try / catch

if err != nil && strings.Contains(err.Error(), "already renamed") {
    return fmt.Errorf("conflicting rename config: %w", err)
}

Prevention

When it happens

Trigger: opts.MapRenames containing multiple entries (across the []map[string]string slices) for the same source map name.

Common situations: 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.

Related errors


AI-assisted analysis of cilium/cilium@ac7b90affa (2026-08-31). Data as JSON: /api/errors/32106ee505f437de. Report an issue: GitHub.