go-delve/delve · error
error setting argument %q: can not convert %s to %s
Error message
error setting argument %q: can not convert %s to %s
What it means
Same converr helper as [727] but without a detail argument: a generic report that value val (of its Starlark type) cannot be converted to dst's Go type. Thrown whenever unmarshalStarlarkValueIntl hits a type case it cannot handle for the destination kind.
Source
Thrown at pkg/terminal/starbind/conv.go:636
// starlark.Value.
func unmarshalStarlarkValue(val starlark.Value, dst any, path string) error {
return unmarshalStarlarkValueIntl(val, reflect.ValueOf(dst), path)
}
func unmarshalStarlarkValueIntl(val starlark.Value, dst reflect.Value, path string) (err error) {
defer func() {
// catches reflect panics
ierr := recover()
if ierr != nil {
err = fmt.Errorf("error setting argument %q to %s: %v", path, val, ierr)
}
}()
converr := func(args ...string) error {
if len(args) > 0 {
return fmt.Errorf("error setting argument %q: can not convert %s to %s: %s", path, val, dst.Type().String(), args[0])
}
return fmt.Errorf("error setting argument %q: can not convert %s to %s", path, val, dst.Type().String())
}
if _, isnone := val.(starlark.NoneType); isnone {
return nil
}
for dst.Kind() == reflect.Ptr {
if dst.IsNil() {
dst.Set(reflect.New(dst.Type().Elem()))
}
dst = dst.Elem()
}
switch val := val.(type) {
case starlark.Bool:
dst.SetBool(bool(val))
case starlark.Int:
switch dst.Kind() {View on GitHub (pinned to a23773e6c3)
Solutions
- Check argument order against the API function signature
- Convert values to the expected Starlark type before calling (int()/float()/str()/bool())
- Replace None/list/dict arguments with properly constructed struct values
- Consult the generated API bindings to see the target Go type
Example fix
# before api.CreateBreakpoint(bp, None) # None where int tid expected # after api.CreateBreakpoint(bp, 0) # pass a concrete typed value
Defensive patterns
Strategy: validation
Validate before calling
assert val is not None, "None not allowed for typed argument" assert not isinstance(val, (list, dict)) or dst_allows_composite, "composite into scalar parameter"
Type guard
def is_none(v):
return v is None # starlark.NoneType maps to Go nil targets only Try / catch
try:
api.SomeCall(val)
except Exception as e:
if "can not convert" in str(e):
fail("bad argument type; check signature order and convert explicitly")
else:
raise Prevention
- Never pass None where a typed (non-pointer) parameter is expected
- Double-check positional argument order
- Convert with int()/float()/str()/bool() before calls
When it happens
Trigger: Any Delve API call from Starlark with an argument whose Starlark type has no registered conversion to the destination Go kind — e.g. passing None where a struct is required, a list into a scalar, or a function value as an argument.
Common situations: Scripts calling typed API entry points with positional arguments in the wrong order so values land in wrong-typed parameters.
Related errors
- error setting argument %q: can not convert %s to %s: %s
- can not assign to %T.%q: %v
- can not assign big integer to %T.%q
- can not assign value of type %T to %T.%q
- key type not supported %T
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/657d1ebf215f86ba.
Report an issue: GitHub.