{"record":{"id":"657d1ebf215f86ba","repo":"go-delve/delve","slug":"error-setting-argument-q-can-not-convert-s-to-657d1e","errorCode":null,"errorMessage":"error setting argument %q: can not convert %s to %s","messagePattern":"error setting argument %q: can not convert (.+?) to (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/terminal/starbind/conv.go","lineNumber":636,"sourceCode":"// starlark.Value.\nfunc unmarshalStarlarkValue(val starlark.Value, dst any, path string) error {\n\treturn unmarshalStarlarkValueIntl(val, reflect.ValueOf(dst), path)\n}\n\nfunc unmarshalStarlarkValueIntl(val starlark.Value, dst reflect.Value, path string) (err error) {\n\tdefer func() {\n\t\t// catches reflect panics\n\t\tierr := recover()\n\t\tif ierr != nil {\n\t\t\terr = fmt.Errorf(\"error setting argument %q to %s: %v\", path, val, ierr)\n\t\t}\n\t}()\n\n\tconverr := func(args ...string) error {\n\t\tif len(args) > 0 {\n\t\t\treturn fmt.Errorf(\"error setting argument %q: can not convert %s to %s: %s\", path, val, dst.Type().String(), args[0])\n\t\t}\n\t\treturn fmt.Errorf(\"error setting argument %q: can not convert %s to %s\", path, val, dst.Type().String())\n\t}\n\n\tif _, isnone := val.(starlark.NoneType); isnone {\n\t\treturn nil\n\t}\n\n\tfor dst.Kind() == reflect.Ptr {\n\t\tif dst.IsNil() {\n\t\t\tdst.Set(reflect.New(dst.Type().Elem()))\n\t\t}\n\t\tdst = dst.Elem()\n\t}\n\n\tswitch val := val.(type) {\n\tcase starlark.Bool:\n\t\tdst.SetBool(bool(val))\n\tcase starlark.Int:\n\t\tswitch dst.Kind() {","sourceCodeStart":618,"sourceCodeEnd":654,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/terminal/starbind/conv.go#L618-L654","documentation":"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.","triggerScenarios":"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.","commonSituations":"Scripts calling typed API entry points with positional arguments in the wrong order so values land in wrong-typed parameters.","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"],"exampleFix":"# before\napi.CreateBreakpoint(bp, None)   # None where int tid expected\n# after\napi.CreateBreakpoint(bp, 0)      # pass a concrete typed value","handlingStrategy":"validation","validationCode":"assert val is not None, \"None not allowed for typed argument\"\nassert not isinstance(val, (list, dict)) or dst_allows_composite, \"composite into scalar parameter\"","typeGuard":"def is_none(v):\n    return v is None  # starlark.NoneType maps to Go nil targets only","tryCatchPattern":"try:\n    api.SomeCall(val)\nexcept Exception as e:\n    if \"can not convert\" in str(e):\n        fail(\"bad argument type; check signature order and convert explicitly\")\n    else:\n        raise","preventionTips":["Never pass None where a typed (non-pointer) parameter is expected","Double-check positional argument order","Convert with int()/float()/str()/bool() before calls"],"tags":["starlark","delve","scripting","type-conversion"],"backgroundTag":"starlark-argument-conversion-failed","analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T22:30:34.772Z"}