wavetermdev/waveterm · error
request packets must have resid set
Error message
request packets must have resid set
What it means
A packet with only ReqId set (no Command) is a follow-up/streaming request in an existing call. It must include ResId to identify which route/response stream it belongs to; otherwise the receiver cannot correlate it. Validate enforces ReqId implies ResId.
Source
Thrown at pkg/wshutil/wshrpc.go:175
return fmt.Errorf("cancel packets may not have data set")
}
return nil
}
if r.Command != "" {
if r.ResId != "" {
return fmt.Errorf("command packets may not have resid set")
}
if r.Error != "" {
return fmt.Errorf("command packets may not have error set")
}
if r.DataType != "" {
return fmt.Errorf("command packets may not have datatype set")
}
return nil
}
if r.ReqId != "" {
if r.ResId == "" {
return fmt.Errorf("request packets must have resid set")
}
if r.Timeout != 0 {
return fmt.Errorf("non-command request packets may not have timeout set")
}
return nil
}
if r.ResId != "" {
if r.Command != "" {
return fmt.Errorf("response packets may not have command set")
}
if r.ReqId == "" {
return fmt.Errorf("response packets must have reqid set")
}
if r.Timeout != 0 {
return fmt.Errorf("response packets may not have timeout set")
}
return nil
}View on GitHub (pinned to a4447c1563)
Solutions
- Set ResId on the follow-up packet to match the ongoing response stream
- Ensure the sender uses the library's response helpers rather than manual message construction
- Add a Validate() call before sending to catch this at the producer
Example fix
// before
msg := wshutil.RpcMessage{ReqId: reqId, Data: chunk}
// after
msg := wshutil.RpcMessage{ReqId: reqId, ResId: resId, Data: chunk} Defensive patterns
Strategy: validation
Validate before calling
if msg.ReqId != "" && msg.Command == "" && msg.ResId == "" {
return fmt.Errorf("follow-up request requires resid")
}
if err := msg.Validate(); err != nil { return err } Type guard
func isAddressedRequest(msg wshutil.RpcMessage) bool {
return msg.ReqId == "" || msg.ResId != "" || msg.Command != ""
} Try / catch
if err := msg.Validate(); err != nil {
return fmt.Errorf("request missing resid: %w", err)
} Prevention
- Always propagate ResId into streaming/follow-up packets
- Prefer the library's response-writer helpers over manual packet building
- Check stream continuation code paths after protocol upgrades
When it happens
Trigger: Calling Validate on an RpcMessage with ReqId set, Command empty, and ResId empty.
Common situations: Streaming/stream-adjacent RPCs (e.g. terminal output, event chunks) where continuation packets forget the ResId; hand-rolled client code sending raw ReqId packets.
Related errors
- blockid is required
- size must be greater than 0
- invalid context, must have a routeid
- request packets may not have both reqid and resid set
- cancel packets may not have command set
AI-assisted analysis of wavetermdev/waveterm@a4447c1563 (2026-09-01).
Data as JSON: /api/errors/e0311be075f77a59.
Report an issue: GitHub.