go-delve/delve · error

unknown access type: %q

Error message

unknown access type: %q

What it means

The accessType field of a DAP data breakpoint must be one of 'read', 'write', or 'readWrite'. Any other string is rejected because Delve cannot map it to a hardware watchpoint WatchType.

Source

Thrown at service/dap/server.go:2006

		v := strings.SplitN(want.DataId, ",", 3)
		if len(v) != 3 {
			return nil, fmt.Errorf("malformed data ID: %q", want.DataId)
		}
		goid, err1 := strconv.ParseInt(v[0], 0, 64)
		frame, err2 := strconv.ParseInt(v[1], 0, 64)
		if err1 != nil || err2 != nil {
			return nil, fmt.Errorf("malformed data ID: %q", want.DataId)
		}
		var wtype api.WatchType
		switch want.AccessType {
		case "read":
			wtype = api.WatchRead
		case "write":
			wtype = api.WatchWrite
		case "readWrite":
			wtype = api.WatchRead | api.WatchWrite
		default:
			return nil, fmt.Errorf("unknown access type: %q", want.AccessType)
		}
		return &bpLocation{
			watchpoint: true,
			goid:       goid,
			frame:      int(frame),
			expr:       v[2],
			wtype:      wtype,
		}, nil
	})

	response := &dap.SetDataBreakpointsResponse{Response: *s.newResponse(request.Request)}
	response.Body.Breakpoints = breakpoints
	s.send(response)
}

func (s *Session) clearBreakpoints(existingBps map[string]*api.Breakpoint, amendedBps map[string]struct{}) error {
	for req, bp := range existingBps {
		if _, ok := amendedBps[req]; ok {

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Send one of exactly 'read', 'write', or 'readWrite' (case-sensitive)
  2. If unsure, use 'write' which is the most commonly supported watchpoint type
  3. Omit the field only if the client previously obtained the dataId, then match the DAP spec's default ('write')

Example fix

// before
{"accessType":"RW"}
// after
{"accessType":"readWrite"}
Defensive patterns

Strategy: validation

Validate before calling

var accessTypes = map[string]bool{"read":true,"write":true,"readWrite":true}
func validAccessType(a string) bool { return accessTypes[a] }

Type guard

func normalizeAccessType(a string) (string, bool) {
  switch a { case "read","write","readWrite": return a, true; default: return "", false }
}

Try / catch

if err := setDataBreakpoints(req); err != nil { if strings.Contains(err.Error(), "unknown access type") { /* set accessType='write' and retry */ } }

Prevention

When it happens

Trigger: setDataBreakpoints with Arguments.Breakpoints[i].AccessType outside the three supported values (empty, uppercase, 'rw', etc.).

Common situations: Clients defaulting accessType to '' or sending a non-DAP-spec value; older clients using different watchpoint vocabularies.

Understand the failure class

Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.

Related errors


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