go-delve/delve · error
unimplemented comparison of %s variables
Error message
unimplemented comparison of %s variables
What it means
This is compareOp's fallback for kinds without a dedicated equality implementation: any kind not explicitly handled (numeric, string, bool, ptr, complex, struct, array, interface, etc.) lands in the default branch and reports an unimplemented comparison. It signals a gap in Delve's evaluator rather than a rule of the Go language.
Source
Thrown at pkg/proc/eval.go:2684
eql, err = equalChildren(xv, yv, true)
case reflect.Struct:
if len(xv.Children) != len(yv.Children) {
return false, nil
}
if int64(len(xv.Children)) != xv.Len || int64(len(yv.Children)) != yv.Len {
return false, errors.New("structure too deep for comparison")
}
eql, err = equalChildren(xv, yv, false)
case reflect.Slice, reflect.Map, reflect.Func, reflect.Chan:
return false, fmt.Errorf("can not compare %s variables", xv.Kind.String())
case reflect.Interface:
if xv.Children[0].RealType.String() != yv.Children[0].RealType.String() {
eql = false
} else {
eql, err = compareOp(token.EQL, &xv.Children[0], &yv.Children[0])
}
default:
return false, fmt.Errorf("unimplemented comparison of %s variables", xv.Kind.String())
}
if op == token.NEQ {
return !eql, err
}
return eql, err
}
func (v *Variable) isNil() bool {
switch v.Kind {
case reflect.Ptr:
return v.Children[0].Addr == 0
case reflect.Interface:
return v.Children[0].Addr == 0 && v.Children[0].Kind == reflect.Invalid
case reflect.Slice, reflect.Map, reflect.Func, reflect.Chan:
return v.Base == 0
}
return falseView on GitHub (pinned to a23773e6c3)
Solutions
- Compare the underlying representation instead: cast fields or compare components individually.
- Upgrade Delve — support for more kinds is added over time.
- File a bug with the type/kind if the comparison should be supported.
Example fix
// before p x == y // unimplemented kind // after p x.field == y.field
Defensive patterns
Strategy: fallback
Validate before calling
// stick to kinds Delve implements: numbers, strings, bools, ptrs, complex, struct, array, interface // otherwise compare components individually
Type guard
func implementedComparison(k reflect.Kind) bool {
switch k {
case reflect.Bool, reflect.Int, reflect.Int8, reflect.Int16, reflect.Int32, reflect.Int64,
reflect.Uint, reflect.Uint8, reflect.Uint16, reflect.Uint32, reflect.Uint64,
reflect.Uintptr, reflect.Float32, reflect.Float64, reflect.Complex64, reflect.Complex128,
reflect.String, reflect.Ptr, reflect.UnsafePointer, reflect.Struct, reflect.Array, reflect.Interface:
return true
}
return false
} Prevention
- Compare known-good kinds (numbers, strings, pointers) only.
- Break exotic values into fields and compare those.
- Keep Delve up to date; unimplemented kinds shrink over time.
When it happens
Trigger: Comparing variables whose Kind is not among the kinds compareOp implements, e.g. certain unsafe/complex or unusual kinds reached after type negotiation, via `p x == y`.
Common situations: Exotic or internal runtime types surfacing in an expression, or a Delve version lacking support for a newly added kind; users comparing values that a newer Delve could handle.
Related errors
- shift count must not be negative
- invalid argument %s (type %s) for cap
- wrong number of arguments to len: %d
- invalid argument %s (type %s) for len
- wrong number of arguments to complex: %d
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/01235fdb98ed33c6.
Report an issue: GitHub.