go-delve/delve · error
can not watch stack allocated variable for reads
Error message
can not watch stack allocated variable for reads
What it means
Error "can not watch stack allocated variable for reads" thrown in go-delve/delve.
Source
Thrown at pkg/proc/breakpoints.go:773
// Use the data field as our watch target
xv = data
expr = expr + " (interface data)"
}
sz := xv.DwarfType.Size()
if sz <= 0 || sz > int64(t.BinInfo().Arch.PtrSize()) {
//TODO(aarzilli): it is reasonable to expect to be able to watch string
//variables and we could support it by watching certain member fields here.
return nil, fmt.Errorf("can not watch variable of type %s", xv.DwarfType.String())
}
stackWatch := scope.g != nil && !scope.g.SystemStack && xv.Addr >= scope.g.stack.lo && xv.Addr < scope.g.stack.hi
if stackWatch && wtype&WatchRead != 0 {
// In theory this would work except for the fact that the runtime will
// read them randomly to resize stacks so it doesn't make sense to do
// this.
return nil, errors.New("can not watch stack allocated variable for reads")
}
bp, err := t.setBreakpointInternal(logicalID, xv.Addr, UserBreakpoint, wtype.withSize(uint8(sz)), cond)
if err != nil {
return bp, err
}
bp.WatchExpr = expr
if stackWatch {
bp.watchStackOff = int64(bp.Addr) - int64(scope.g.stack.hi)
err := t.setStackWatchBreakpoints(scope, bp)
if err != nil {
return bp, err
}
}
return bp, nil
}View on GitHub (pinned to a23773e6c3)
When it happens
Trigger: Thrown at pkg/proc/breakpoints.go:773 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31).
Data as JSON: /api/errors/a8b331d4d7ebe7f5.
Report an issue: GitHub.