{"record":{"id":"cd1fafb46b382703","repo":"go-delve/delve","slug":"could-not-read-g-struct","errorCode":null,"errorMessage":"could not read G struct","messagePattern":"could not read G struct","errorType":"exception","errorClass":"ErrUnreadableG","httpStatus":null,"severity":"error","filePath":"pkg/proc/variables.go","lineNumber":884,"sourceCode":"\t\t\tname = fmt.Sprintf(\"%s.%s\", v.Name, parts[1])\n\t\t} else {\n\t\t\tname = fmt.Sprintf(\"%s.%s\", v.Name, field.Name)\n\t\t}\n\t}\n\treturn v.newVariable(name, uint64(int64(v.Addr)+field.ByteOffset), field.Type, v.mem), nil\n}\n\n// ErrNoGoroutine returned when a G could not be found\n// for a specific thread.\ntype ErrNoGoroutine struct {\n\ttid int\n}\n\nfunc (ng ErrNoGoroutine) Error() string {\n\treturn fmt.Sprintf(\"no G executing on thread %d\", ng.tid)\n}\n\nvar ErrUnreadableG = errors.New(\"could not read G struct\")\n\nfunc (v *Variable) parseG() (*G, error) {\n\tmem := v.mem\n\tgaddr := v.Addr\n\t_, deref := v.RealType.(*godwarf.PtrType)\n\n\tif deref {\n\t\tvar err error\n\t\tgaddr, err = readUintRaw(mem, gaddr, int64(v.bi.Arch.PtrSize()))\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"error derefing *G %s\", err)\n\t\t}\n\t}\n\tif gaddr == 0 {\n\t\tid := 0\n\t\tif thread, ok := mem.(Thread); ok {\n\t\t\tid = thread.ThreadID()\n\t\t}","sourceCodeStart":866,"sourceCodeEnd":902,"githubUrl":"https://github.com/go-delve/delve/blob/a23773e6c31361e43246bc43a424ee009679b174/pkg/proc/variables.go#L866-L902","documentation":"Error \"could not read G struct\" thrown in go-delve/delve.","triggerScenarios":"Thrown at pkg/proc/variables.go:884 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"}