golang/go · error

internal error: collision during call site table merge, fn=%

Error message

internal error: collision during call site table merge, fn=%s callsite=%s

What it means

Returned by CallSiteTab.merge when two call-site tables being merged already share a key (the same call-site position/callee). The message names it an internal error because the merge is part of building the inlheur call-site analysis, which should never receive overlapping entries. Hitting it means the analysis produced duplicate call-site records.

Source

Thrown at src/cmd/compile/internal/inline/inlheur/callsite.go:92

// (stringified src.XPos plus call site ID) mapping to a value of call
// property bits and score.
type encodedCallSiteTab map[string]propsAndScore

type propsAndScore struct {
	props CSPropBits
	score int
	mask  scoreAdjustTyp
}

func (pas propsAndScore) String() string {
	return fmt.Sprintf("P=%s|S=%d|M=%s", pas.props.String(),
		pas.score, pas.mask.String())
}

func (cst CallSiteTab) merge(other CallSiteTab) error {
	for k, v := range other {
		if prev, ok := cst[k]; ok {
			return fmt.Errorf("internal error: collision during call site table merge, fn=%s callsite=%s", prev.Callee.Sym().Name, fmtFullPos(prev.Call.Pos()))
		}
		cst[k] = v
	}
	return nil
}

func fmtFullPos(p src.XPos) string {
	var sb strings.Builder
	sep := ""
	base.Ctxt.AllPos(p, func(pos src.Pos) {
		sb.WriteString(sep)
		sep = "|"
		file := filepath.Base(pos.Filename())
		fmt.Fprintf(&sb, "%s:%d:%d", file, pos.Line(), pos.Col())
	})
	return sb.String()
}

View on GitHub (pinned to b6b368adc5)

Solutions

  1. Report/fix upstream: this is a compiler-internal invariant violation, not user-fixable in user code.
  2. Bisect recent changes to callsite keying (Pos + Callee) to find the duplicate producer.
  3. As a workaround, disable the inlheur dump flag that triggers the merge.
Defensive patterns

Strategy: validation

Validate before calling

// Before merging, verify no key overlap.
for k := range other {
    if _, dup := cst[k]; dup {
        return fmt.Errorf("refusing merge: duplicate callsite key")
    }
}

Prevention

When it happens

Trigger: Two CallSiteTab maps passed to merge() contain the same key; the second insertion sees prev, ok := cst[k] true and aborts with the previous entry's Callee name and position.

Common situations: Compiler development only: a change to how call sites are keyed (position vs callee symbol) produces collisions; running inlheur analysis on a program with instantiated generics where the same callsite key is emitted twice.

Related errors


AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12). Data as JSON: /api/errors/24c3762ae27e8250. Report an issue: GitHub.