go-delve/delve · error

could not read string pointer %s

Error message

could not read string pointer %s

What it means

While loading a string header, Delve could not read the `str` (data pointer) field from target memory via `readUintRaw`. The memory-read error is embedded in the message. Without the data pointer the string's bytes cannot be fetched.

Source

Thrown at pkg/proc/variables.go:1547

	var strlen int64
	var outaddr uint64
	var err error

	for _, field := range typ.StructType.Field {
		switch field.Name {
		case "len":
			strlen, err = readIntRaw(mem, addr+uint64(field.ByteOffset), int64(arch.PtrSize()))
			if err != nil {
				return 0, 0, fmt.Errorf("could not read string len %s", err)
			}
			if strlen < 0 {
				return 0, 0, fmt.Errorf("invalid length: %d", strlen)
			}
		case "str":
			outaddr, err = readUintRaw(mem, addr+uint64(field.ByteOffset), int64(arch.PtrSize()))
			if err != nil {
				return 0, 0, fmt.Errorf("could not read string pointer %s", err)
			}
			if addr == 0 {
				return 0, 0, nil
			}
		}
	}

	return outaddr, strlen, nil
}

func readStringValue(mem MemoryReadWriter, addr uint64, strlen int64, cfg LoadConfig) (string, error) {
	if strlen == 0 {
		return "", nil
	}

	count := min(strlen, int64(cfg.MaxStringLen))

	val := make([]byte, int(count))

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Check the embedded cause (%s) for the actual memory error.
  2. Print the enclosing struct to verify the header address is sane.
  3. Re-dump core with complete memory or debug the live process.
  4. Re-evaluate after the target state is consistent.
Defensive patterns

Strategy: retry

Validate before calling

// (dlv) print str
// (dlv) print str.len   // if len is readable but str is not, the page is unmapped

Try / catch

if strings.Contains(err.Error(), "could not read string pointer") {
    return retryAfterTargetStable(expr)
}

Prevention

When it happens

Trigger: Evaluating a string variable or field when the pointer-size read at the `str` field's byte offset fails, e.g. the header address is invalid or the page is unmapped.

Common situations: Same contexts as len-read failures: incomplete core dumps, remote sessions dropping, stale frame addresses; also happens when the string lives on a page not captured in the dump.

Related errors


AI-assisted analysis of go-delve/delve@a23773e6c3 (2026-08-31). Data as JSON: /api/errors/16ced00da3138ec4. Report an issue: GitHub.