vitessio/vitess · error
unsupported type: %T
Error message
unsupported type: %T
What it means
evalToInt64's outer type switch converts any eval to an int64; an unhandled eval concrete type reaches the default branch and panics with "unsupported type: %T". It signals the eval engine was asked for integer coercion of a type it does not know.
Source
Thrown at go/vt/vtgate/evalengine/eval_numeric.go:364
f, _ := e.Float64()
return newEvalInt64(floatToInt64(f))
default:
panic("unsupported")
}
case json.TypeString:
i, _ := fastparse.ParseInt64(e.Raw(), 10)
return newEvalInt64(i)
default:
return newEvalInt64(0)
}
case *evalTemporal:
return newEvalInt64(e.toInt64())
case *evalEnum:
return newEvalInt64(enumNumeric(e.value))
case *evalSet:
return newEvalInt64(int64(e.set))
default:
panic(fmt.Sprintf("unsupported type: %T", e))
}
}
func (e *evalInt64) Hash(h *vthash.Hasher) {
if e.i < 0 {
h.Write16(hashPrefixIntegralNegative)
} else {
h.Write16(hashPrefixIntegralPositive)
}
h.Write64(uint64(e.i))
}
func (e *evalInt64) SQLType() sqltypes.Type {
return sqltypes.Int64
}
func (e *evalInt64) Size() int32 {
return 0View on GitHub (pinned to 01a25a7d17)
Solutions
- Add a case for the reported %T type in evalToInt64 in go/vt/vtgate/evalengine/eval_numeric.go
- Validate expression operand types earlier (during planning/typing) so unsupported types never reach coercion
- Upgrade to a vitess release that supports the type in integer coercion
Example fix
// before
default:
panic(fmt.Sprintf("unsupported type: %T", e))
// after
case *evalMyNewType:
return newEvalInt64(e.toInt64())
default:
panic(fmt.Sprintf("unsupported type: %T", e)) Defensive patterns
Strategy: type-guard
Validate before calling
switch v.(type) {
case evalNumeric, *evalEnum, *evalSet:
// coercible
default:
return vterrors.Errorf(vtrpcpb.Code_INVALID_ARGUMENT, "type %T not int-coercible", v)
} Type guard
func isIntCoercible(e eval) bool {
switch e.(type) {
case evalNumeric, *evalEnum, *evalSet:
return true
default:
return false
}
} Try / catch
defer func() {
if r := recover(); r != nil {
err = vterrors.Errorf(vtrpcpb.Code_INTERNAL, "evalToInt64: %v", r)
}
}() Prevention
- Extend all five conversion helpers (float/decimal/int64/etc.) whenever a new eval type is added
- Gate non-scalar types out during expression analysis/typing
- Use %T in panic messages to make triage immediate
When it happens
Trigger: Calling evalToInt64 (via run, evalCoerce, valueToEvalCast, translateIntegral) with an eval type absent from the switch — typically a newly added eval implementation.
Common situations: Adding new eval types in the evalengine without updating every conversion helper; internal callers passing composite/tuple values into integer contexts.
Related errors
- unsupported type %T
- malformed hex literal from parser
- bad unsigned integer type
- bad type aggregation for signed/unsigned types
- unreachable
AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01).
Data as JSON: /api/errors/0d8c627f03f655cc.
Report an issue: GitHub.