labstack/echo · error
unsupported value type: %T
Error message
unsupported value type: %T
What it means
Returned by bindValue (binder_generic.go:567-569) when the destination type matches none of the supported switch cases: bool, floats, ints, uints, string, time.Duration, time.Time, BindUnmarshaler, encoding.TextUnmarshaler, json.Unmarshaler. T fell through to the default branch.
Source
Thrown at binder_generic.go:568
if err != nil {
return err
}
}
*d = t.In(to.ToInLocation)
case BindUnmarshaler:
if err := d.UnmarshalParam(value); err != nil {
return err
}
case encoding.TextUnmarshaler:
if err := d.UnmarshalText([]byte(value)); err != nil {
return err
}
case json.Unmarshaler:
if err := d.UnmarshalJSON([]byte(value)); err != nil {
return err
}
default:
return fmt.Errorf("unsupported value type: %T", dest)
}
return nil
}
View on GitHub (pinned to 05489dc173)
Solutions
- Implement echo.BindUnmarshaler, encoding.TextUnmarshaler, or json.Unmarshaler on the type
- Use c.Bind for whole structs rather than ParseValue per field
- Use ParseValues[T] with a slice element type for repeated values
Example fix
// before
type Color struct{ R, G, B int }
v, err := echo.ParseValue[Color]("#fff")
// after — implement TextUnmarshaler:
func (c *Color) UnmarshalText(b []byte) error { /* parse hex */ return nil }
v, err := echo.ParseValue[Color]("#fff") Defensive patterns
Strategy: type-guard
Validate before calling
var z T
switch any(z).(type) {
case echo.BindUnmarshaler, encoding.TextUnmarshaler, json.Unmarshaler:
// ok
default:
// fall back to c.Bind for the whole struct
} Type guard
func isBindable[T any]() bool {
var z T
switch any(z).(type) {
case echo.BindUnmarshaler, encoding.TextUnmarshaler, json.Unmarshaler:
return true
}
return false
} Prevention
- Implement TextUnmarshaler on custom scalar types
- Use c.Bind for structs and ParseValue for scalars
When it happens
Trigger: ParseValue[MyStruct](...) where MyStruct implements none of the unmarshaler interfaces; arrays/maps; pointers to unsupported types; structs without a custom unmarshaler.
Common situations: Binding a complex struct field from a single scalar value instead of using c.Bind; nested types; third-party types lacking TextUnmarshaler.
Related errors
- options are only supported for time.Time, got %T
- binding element must be a struct
- query/param/form tags are not allowed with anonymous struct
- unknown type
- binding to multipart.FileHeader struct is not supported, use
AI-assisted analysis of labstack/echo@05489dc173 (2026-08-04).
Data as JSON: /data/errors/4f588aa019657ae2.json.
Report an issue: GitHub.