go-delve/delve · error
must specify at least one argument for qRRCmd
Error message
must specify at least one argument for qRRCmd
What it means
qRRCmd sends the 'qRRCmd' packet used to query/mutate mozilla rr state. It requires at least one argument because the packet format joins arguments with ':' after the command name; calling it with zero arguments would produce a malformed packet, so it panics instead.
Source
Thrown at pkg/proc/gdbserial/gdbserver_conn.go:1196
return sp, nil
}
// restart executes a 'vRun' command.
func (conn *gdbConn) restart(pos string) error {
conn.outbuf.Reset()
fmt.Fprint(&conn.outbuf, "$vRun;")
if pos != "" {
fmt.Fprint(&conn.outbuf, ";")
writeAsciiBytes(&conn.outbuf, []byte(pos))
}
_, err := conn.exec(conn.outbuf.Bytes(), "restart")
return err
}
// qRRCmd executes a qRRCmd command
func (conn *gdbConn) qRRCmd(args ...string) (string, error) {
if len(args) == 0 {
panic("must specify at least one argument for qRRCmd")
}
conn.outbuf.Reset()
fmt.Fprint(&conn.outbuf, "$qRRCmd")
for i, arg := range args {
fmt.Fprint(&conn.outbuf, ":")
if i == 0 && (conn.newRRCmdStyle || conn.threadSuffixSupported) {
// newer versions of RR require the command to be followed by a thread id
// and the command name to be unescaped.
fmt.Fprintf(&conn.outbuf, "%s:-1", arg)
} else {
writeAsciiBytes(&conn.outbuf, []byte(arg))
}
}
resp, err := conn.exec(conn.outbuf.Bytes(), "qRRCmd")
if err != nil {
return "", err
}
data := make([]byte, 0, len(resp)/2)View on GitHub (pinned to a23773e6c3)
Solutions
- Always pass at least one argument, e.g. conn.qRRCmd("checkpoints")
- Audit the call site that builds the args slice; guard against len(args)==0 before calling
- If the command legitimately takes no args, send a different packet or a default argument supported by rr
Example fix
// before
conn.qRRCmd(args...)
// after
if len(args) == 0 {
return "", errors.New("qRRCmd requires arguments")
}
conn.qRRCmd(args...) Defensive patterns
Strategy: validation
Validate before calling
if len(args) == 0 {
return errors.New("qRRCmd requires at least one argument")
} Try / catch
defer func() {
if r := recover(); r != nil { err = fmt.Errorf("qRRCmd: %v", r) }
}() Prevention
- Guard variadic arg slices before packet construction
- Consult rr's qRRCmd documentation for valid argument forms
- Add unit tests for packet builders with empty inputs
When it happens
Trigger: Calling conn.qRRCmd() with no variadic arguments from internal code (e.g. rr checkpoint/readPacket helpers built incorrectly).
Common situations: Custom rr integration code, patched forks of delve, or new features issuing qRRCmd queries with a dynamically built (and accidentally empty) argument list.
Related errors
- can not start a call injection while running backwards
- not implemented
- threadUpdater: Add after Finish
- unsupported operating system attempting to find Goroutine on
- selectThread when thread suffix is supported
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/4e167ffac2843e26.
Report an issue: GitHub.