{"record":{"id":"a8b331d4d7ebe7f5","repo":"go-delve/delve","slug":"can-not-watch-stack-allocated-variable-for-reads","errorCode":null,"errorMessage":"can not watch stack allocated variable for reads","messagePattern":"can not watch stack allocated variable for reads","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/proc/breakpoints.go","lineNumber":773,"sourceCode":"\t\t// Use the data field as our watch target\n\t\txv = data\n\t\texpr = expr + \" (interface data)\"\n\t}\n\n\tsz := xv.DwarfType.Size()\n\tif sz <= 0 || sz > int64(t.BinInfo().Arch.PtrSize()) {\n\t\t//TODO(aarzilli): it is reasonable to expect to be able to watch string\n\t\t//variables and we could support it by watching certain member fields here.\n\t\treturn nil, fmt.Errorf(\"can not watch variable of type %s\", xv.DwarfType.String())\n\t}\n\n\tstackWatch := scope.g != nil && !scope.g.SystemStack && xv.Addr >= scope.g.stack.lo && xv.Addr < scope.g.stack.hi\n\n\tif stackWatch && wtype&WatchRead != 0 {\n\t\t// In theory this would work except for the fact that the runtime will\n\t\t// read them randomly to resize stacks so it doesn't make sense to do\n\t\t// this.\n\t\treturn nil, errors.New(\"can not watch stack allocated variable for reads\")\n\t}\n\n\tbp, err := t.setBreakpointInternal(logicalID, xv.Addr, UserBreakpoint, wtype.withSize(uint8(sz)), cond)\n\tif err != nil {\n\t\treturn bp, err\n\t}\n\tbp.WatchExpr = expr\n\n\tif stackWatch {\n\t\tbp.watchStackOff = int64(bp.Addr) - int64(scope.g.stack.hi)\n\t\terr := t.setStackWatchBreakpoints(scope, bp)\n\t\tif err != nil {\n\t\t\treturn bp, err\n\t\t}\n\t}\n\n\treturn bp, nil\n}","sourceCodeStart":755,"sourceCodeEnd":791,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/breakpoints.go#L755-L791","documentation":"Error \"can not watch stack allocated variable for reads\" thrown in go-delve/delve.","triggerScenarios":"Thrown at pkg/proc/breakpoints.go:773 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a23773e6c31361e43246bc43a424ee009679b174","analyzedAt":"2026-08-31T15:12:45.221Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}