go-delve/delve · error · ErrUnreadableG

could not read G struct

Error message

could not read G struct

What it means

Error "could not read G struct" thrown in go-delve/delve.

Source

Thrown at pkg/proc/variables.go:884

			name = fmt.Sprintf("%s.%s", v.Name, parts[1])
		} else {
			name = fmt.Sprintf("%s.%s", v.Name, field.Name)
		}
	}
	return v.newVariable(name, uint64(int64(v.Addr)+field.ByteOffset), field.Type, v.mem), nil
}

// ErrNoGoroutine returned when a G could not be found
// for a specific thread.
type ErrNoGoroutine struct {
	tid int
}

func (ng ErrNoGoroutine) Error() string {
	return fmt.Sprintf("no G executing on thread %d", ng.tid)
}

var ErrUnreadableG = errors.New("could not read G struct")

func (v *Variable) parseG() (*G, error) {
	mem := v.mem
	gaddr := v.Addr
	_, deref := v.RealType.(*godwarf.PtrType)

	if deref {
		var err error
		gaddr, err = readUintRaw(mem, gaddr, int64(v.bi.Arch.PtrSize()))
		if err != nil {
			return nil, fmt.Errorf("error derefing *G %s", err)
		}
	}
	if gaddr == 0 {
		id := 0
		if thread, ok := mem.(Thread); ok {
			id = thread.ThreadID()
		}

View on GitHub (pinned to a23773e6c3)

When it happens

Trigger: Thrown at pkg/proc/variables.go:884 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/cd1fafb46b382703. Report an issue: GitHub.