go-delve/delve · error

can not parse "info checkpoints" output line %q: %v

Error message

can not parse "info checkpoints" output line %q: %v

What it means

Second parsing failure in CheckpointsList: the line had 3 fields but the first field (checkpoint ID) is not a decimal integer, so strconv.Atoi fails; the error is wrapped into this message with the line and the Atoi error.

Source

Thrown at pkg/proc/gdbserial/gdbserver.go:1222

		return nil, proc.ErrNotRecorded
	}
	resp, err := p.conn.qRRCmd("info checkpoints")
	if err != nil {
		return nil, err
	}
	lines := strings.Split(resp, "\n")
	r := make([]proc.Checkpoint, 0, len(lines)-1)
	for _, line := range lines[1:] {
		if line == "" {
			continue
		}
		fields := strings.Split(line, "\t")
		if len(fields) != 3 {
			return nil, fmt.Errorf("can not parse \"info checkpoints\" output line %q", line)
		}
		cpid, err := strconv.Atoi(fields[0])
		if err != nil {
			return nil, fmt.Errorf("can not parse \"info checkpoints\" output line %q: %v", line, err)
		}
		r = append(r, proc.Checkpoint{ID: cpid, When: fields[1], Where: fields[2]})
	}
	return r, nil
}

const deleteCheckpointPrefix = "Deleted checkpoint "

// ClearCheckpoint clears the checkpoint for the given ID.
func (p *gdbProcess) ClearCheckpoint(id int) error {
	if p.tracedir == "" {
		return proc.ErrNotRecorded
	}
	resp, err := p.conn.qRRCmd("delete checkpoint", strconv.Itoa(id))
	if err != nil {
		return err
	}
	if !strings.HasPrefix(resp, deleteCheckpointPrefix) {

View on GitHub (pinned to a23773e6c3)

Solutions

  1. Ensure the stub emits the standard gdbserver header and body ('Id', 'When', 'Where' header is skipped via lines[1:])
  2. Check the Atoi error in the message to identify the exact offending text
  3. Patch the stub to output numeric IDs in the first column
  4. List checkpoints with gdb directly to confirm the expected output format
Defensive patterns

Strategy: validation

Validate before calling

idNumeric := func(line string) bool {
    f := strings.Split(line, "\t")
    if len(f) != 3 { return false }
    _, err := strconv.Atoi(f[0]); return err == nil
}

Try / catch

cps, err := proc.CheckpointsList()
if err != nil {
    var pe *strconv.NumError
    if errors.As(err, &pe) || strings.Contains(err.Error(), "can not parse \"info checkpoints\"") {
        return nil, fmt.Errorf("checkpoint ID column not numeric: %w", err)
    }
    return nil, err
}

Prevention

When it happens

Trigger: The 'info checkpoints' line's first column is non-numeric — e.g. an informational line slipped past the 3-field check, a header variant with different column labels, or localized stub output.

Common situations: Stub variants that prepend labels or symbols to IDs; header lines with exactly 3 tab-separated column names like 'Id\tWhen\tWhere' where 'Id' fails Atoi on nonstandard headers.

Related errors


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