plandex-ai/plandex · warning

no line number found

Error message

no line number found

What it means

ExtractLineNumberWithPrefix splits the line at the first space, trims the colon and the expected prefix, and requires a non-empty remainder to parse as the line number. This error means nothing remained after stripping the prefix — the string does not contain a line number in the expected `<prefix><number>:` format.

Source

Thrown at app/shared/streamed_change.go:89

		return 0, 0, fmt.Errorf("start line is less than 1: %d", startLine)
	}

	return startLine, endLine, nil
}

func ExtractLineNumber(line string) (int, error) {
	return ExtractLineNumberWithPrefix(line, "pdx-")
}

func ExtractLineNumberWithPrefix(line, prefix string) (int, error) {
	// Split the line at the first space to isolate the line number
	parts := strings.SplitN(line, " ", 2)

	// Remove the colon from the line number part
	lineNumberStr := strings.TrimSuffix(parts[0], ":")
	lineNumberStr = strings.TrimPrefix(lineNumberStr, prefix)
	if lineNumberStr == "" {
		return 0, fmt.Errorf("no line number found")
	}

	// Convert the line number part to an integer
	lineNumber, err := strconv.Atoi(lineNumberStr)
	if err != nil {
		return 0, fmt.Errorf("invalid line number: %v", err)
	}

	return lineNumber, nil
}

View on GitHub (pinned to e2d772072e)

Solutions

  1. Verify the input is actually a line-number marker line, not arbitrary content
  2. Ensure the `prefix` passed matches exactly the prefix used when generating markers
  3. Check that the line includes digits after the prefix (e.g. "12: code" not ": code")
  4. Trim/handle empty lines before attempting extraction

Example fix

// before
n, err := ExtractLineNumberWithPrefix(line, "|") // line="|: foo"
// after
trimmed := strings.TrimPrefix(line, "|")
if trimmed == "" || !strings.ContainsAny(trimmed, "0123456789") { skip(line) } else { n, err = ExtractLineNumberWithPrefix(line, "|") }
Defensive patterns

Strategy: type-guard

Validate before calling

func isLineNumberMarker(line, prefix string) bool {
    t := strings.TrimPrefix(strings.SplitN(line, " ", 2)[0], prefix)
    t = strings.TrimSuffix(t, ":")
    if t == "" { return false }
    _, err := strconv.Atoi(t)
    return err == nil
}

Type guard

func looksLikeMarker(line string) bool {
    t := strings.TrimSuffix(strings.SplitN(line, " ", 2)[0], ":")
    return t != "" && strings.ContainsAny(t, "0123456789")
}

Try / catch

n, err := ExtractLineNumberWithPrefix(line, prefix)
if err != nil {
    if strings.Contains(err.Error(), "no line number found") {
        return 0, fmt.Errorf("line %q is not a numbered marker", line)
    }
    return 0, err
}

Prevention

When it happens

Trigger: ExtractLineNumberWithPrefix (directly or via ExtractLineNumber or GetLinesWithPrefix, or handleXMLResponse) receiving an empty string, a string that is only the prefix, or a marker line with no numeric component after the prefix/colon.

Common situations: Calling ExtractLineNumber on a non-marker line (blank line or code line); prefix mismatch so trimming consumed everything; streaming produced an incomplete marker like "12:" with prefix stripping removing the digits.

Related errors


AI-assisted analysis of plandex-ai/plandex@e2d772072e (2026-09-05). Data as JSON: /api/errors/d90b890037a115a6. Report an issue: GitHub.