go-delve/delve · error

could not find memory reference

Error message

could not find memory reference

What it means

Error "could not find memory reference" thrown in go-delve/delve.

Source

Thrown at service/dap/server.go:3990

			lastFile, lastLine = instruction.Loc.File, instruction.Loc.Line
		}
	}

	response := &dap.DisassembleResponse{
		Response: *s.newResponse(request.Request),
		Body: dap.DisassembleResponseBody{
			Instructions: instructions,
		},
	}
	s.send(response)
}

func findInstructions(procInstructions []proc.AsmInstruction, addr uint64, instructionOffset, count int) ([]proc.AsmInstruction, int, error) {
	ref := sort.Search(len(procInstructions), func(i int) bool {
		return procInstructions[i].Loc.PC >= addr
	})
	if ref == len(procInstructions) || procInstructions[ref].Loc.PC != addr {
		return nil, -1, errors.New("could not find memory reference")
	}
	// offset is the number of instructions that should appear before the first instruction
	// returned by findInstructions.
	offset := 0
	if ref+instructionOffset < 0 {
		offset = -(ref + instructionOffset)
	}
	// Figure out the index to slice at.
	startIdx := ref + instructionOffset
	endIdx := ref + instructionOffset + count
	if endIdx <= 0 || startIdx >= len(procInstructions) {
		return []proc.AsmInstruction{}, 0, nil
	}
	// Adjust start and end to be inbounds.
	if startIdx < 0 {
		offset = -startIdx
		startIdx = 0
	}

View on GitHub (pinned to a23773e6c3)

When it happens

Trigger: Thrown at service/dap/server.go:3990 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/195da73b0d6676ae. Report an issue: GitHub.