Skip to content

Errors column shows "12:5: error: 'x' undeclared" instead of "'x' undeclared" when the file path contains "error" #415

Open

Description

@matt-edmondson

What's wrong

In ParseLogForErrors (BuildMonitor/Providers/GitHub.cs:725-728, main @ 561fdb3) a line is selected by ErrorPatternRegex() ((?:^|\s)error\s*:), but the message is then cut at the first : after trimmedLine.IndexOf("error", OrdinalIgnoreCase) — the first "error" anywhere in the line, not where the regex matched. A path or repo name containing "error" moves the cut to the first colon after the path.

Repro

Calling the method (via reflection) on GCC/clang-style log lines:

"...Z /home/runner/work/error-codes/error-codes/src/parse.c:12:5: error: 'x' undeclared (first use in this function)"
  -> "12:5: error: 'x' undeclared (first use in this function)"
"...Z src/errors.c:40:1: error: expected ';' before '}' token"
  -> "40:1: error: expected ';' before '}' token"
"...Z /home/runner/work/app/app/src/parse.c:12:5: error: 'y' undeclared"
  -> "'y' undeclared"   (control)

Expected 'x' undeclared ... and expected ';' before '}' token.

Why it matters

Low impact, but the Errors column shows location-prefixed noise for any repo/file named like errors.c, error-codes, ErrorHandling/..., and the seenErrors de-duplication treats the same compiler error at different locations as distinct messages.

Suggested fix

Use the regex match itself:

Match m = ErrorPatternRegex().Match(trimmedLine);
if (m.Success) { string errorMessage = trimmedLine[(m.Index + m.Length)..].Trim(); ... }

Acceptance: a test with the first two lines above yields the bare messages; existing log-parsing tests still pass.

Activity

  1. matt-edmondson commented on Nov 11, 2026

    @matt-edmondson
    ContributorAuthor

    Triage

    Notes: the suggested fix, slicing from the regex match, is small and self-contained. It's worth doing alongside #325 if someone is already reworking ParseLogForErrors.


    Generated by Claude Code

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

bugSomething isn't working

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions