wavetermdev/waveterm · error
invalid argument type %s
Error message
invalid argument type %s
What it means
Thrown by convertArgument's default branch when a service method parameter's reflect.Kind is one the RPC bridge does not support at all (anything outside String, Bool, numeric, Map, Slice, Struct, Ptr, and special wave arg types) — e.g. channels, funcs, interfaces, complex numbers, or unsafe pointers.
Source
Thrown at pkg/service/service.go:262
return convertComplex(argType, jsonArg)
case reflect.Struct:
if jsonType.Kind() != reflect.Map {
return nil, fmt.Errorf("cannot convert %T to %s", jsonArg, argType)
}
return convertComplex(argType, jsonArg)
case reflect.Ptr:
if argType.Elem().Kind() != reflect.Struct {
return nil, fmt.Errorf("invalid pointer type %s", argType)
}
if jsonType.Kind() != reflect.Map {
return nil, fmt.Errorf("cannot convert %T to %s", jsonArg, argType)
}
return convertComplex(argType, jsonArg)
default:
return nil, fmt.Errorf("invalid argument type %s", argType)
}
}
func isNilable(val reflect.Value) bool {
switch val.Kind() {
case reflect.Ptr, reflect.Slice, reflect.Map, reflect.Interface, reflect.Chan, reflect.Func:
return true
}
return false
}
func convertReturnValues(rtnVals []reflect.Value) *WebReturnType {
rtn := &WebReturnType{}
if len(rtnVals) == 0 {
return rtn
}
for _, val := range rtnVals {View on GitHub (pinned to a4447c1563)
Solutions
- Remove the unsupported parameter type from the service method signature.
- Replace func/chan params with event subscriptions or ids usable with the pubsub system.
- For dynamic payloads, use a supported type such as map[string]any or a struct instead of interface{}.
- If the type is actually a Wave special type (WaveObj etc.), make it match isSpecialWaveArgType's recognized types so it routes through convertSpecial.
Example fix
// before
func (s *Svc) Watch(ch chan int) error
// after
func (s *Svc) Watch(scope string) error { // subscribe via WPS events
...
} Defensive patterns
Strategy: validation
Validate before calling
// audit the Go signature: supported kinds are string,bool,numbers,map,slice,struct,*struct + special wave types
const supported = new Set(['string','bool','number','object','array']);
if (!supported.has(typeof arg)) throw new Error('arg type unsupported by RPC bridge'); Try / catch
try {
const rtn = await callService(svc, method, args);
if (rtn.error?.includes('invalid argument type')) throw new Error('method signature has an unsupported parameter kind');
} catch (e) { /* the method itself must be redesigned; no client-side fix */ } Prevention
- Never expose chan/func/interface{} parameters on RPC services.
- Use map[string]any or structs for dynamic payloads.
- Add a registration-time check that walks each service method's parameter kinds.
When it happens
Trigger: Calling a service method whose signature includes a chan, func, interface{}, complex, or other exotic parameter type; the error fires on any call attempt regardless of the JSON value passed.
Common situations: Adding a callback or channel parameter to an existing service method and exposing it over RPC; using interface{} parameters assuming the bridge passes raw JSON through.
Related errors
- invalid special wave argument type %s
- invalid map key type %s
- invalid pointer type %s
- invalid number type %s
- invalid method: %s.%s
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/4321ac9c12b0c691.
Report an issue: GitHub.