go-delve/delve · error

unknown argument %q

Error message

unknown argument %q

What it means

The generated starlark binding for the GetBreakpoint RPC accepts only whitelisted keyword arguments (here `Id` and `Name`); any other kwarg produces this error before any RPC is made. The message quotes the offending keyword name via %q on the starlark value.

Source

Thrown at pkg/terminal/starbind/starlark_mapping.go:910

			if err != nil {
				return starlark.None, decorateError(thread, err)
			}
		}
		if len(args) > 1 && args[1] != starlark.None {
			err := unmarshalStarlarkValue(args[1], &rpcArgs.Name, "Name")
			if err != nil {
				return starlark.None, decorateError(thread, err)
			}
		}
		for _, kv := range kwargs {
			var err error
			switch kv[0].(starlark.String) {
			case "Id":
				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Id, "Id")
			case "Name":
				err = unmarshalStarlarkValue(kv[1], &rpcArgs.Name, "Name")
			default:
				err = fmt.Errorf("unknown argument %q", kv[0])
			}
			if err != nil {
				return starlark.None, decorateError(thread, err)
			}
		}
		err := env.ctx.Client().CallAPI("GetBreakpoint", &rpcArgs, &rpcRet)
		if err != nil {
			return starlark.None, err
		}
		return env.interfaceToStarlarkValue(&rpcRet), nil
	})
	doc["get_breakpoint"] = "builtin get_breakpoint(Id, Name)\n\nget_breakpoint gets a breakpoint by Name (if Name is not an empty string) or by ID."
	r["get_buffered_tracepoints"] = starlark.NewBuiltin("get_buffered_tracepoints", func(thread *starlark.Thread, _ *starlark.Builtin, args starlark.Tuple, kwargs []starlark.Tuple) (starlark.Value, error) {
		if err := isCancelled(thread); err != nil {
			return starlark.None, decorateError(thread, err)
		}
		var rpcArgs rpc2.GetBufferedTracepointsIn
		var rpcRet rpc2.GetBufferedTracepointsOut

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Use only supported kwargs: Id, Name — see the rpc2 GetBreakpointIn type for the full call contract.
  2. To find a breakpoint by location, create/set the breakpoint first or use ListBreakpoints and filter.
  3. Check generated binding source in pkg/terminal/starbind/starlark_mapping.go for the accepted keys.

Example fix

// before (starlark)
debug.GetBreakpoint(File="main.go", Line=10)
// after
debug.GetBreakpoint(Id=1)
Defensive patterns

Strategy: validation

Validate before calling

# starlark: only Id and Name are accepted
bp = debug.GetBreakpoint(Id=1)
# or
bp = debug.GetBreakpoint(Name="mybp")

Type guard

// Go-side guard on kwargs before building the call:
func validGetBreakpointKw(k string) bool {
    switch k {
    case "Id", "Name":
        return true
    }
    return false
}

Prevention

When it happens

Trigger: Calling `debug.GetBreakpoint(Id=..., SomeOther=...)` with a keyword not in the switch (anything other than "Id" or "Name").

Common situations: Script authors guessing parameter names (e.g. `File`, `Line`) or copying kwargs from a different API call like CreateBreakpoint into GetBreakpoint.

Related errors


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/e7d128bae55dc89f. Report an issue: GitHub.