Reading Red Builds

By Syncfusion®, Inc. · Last updated

Read a failed run in five steps and fix the failures you meet at work: wrong tool version, a missing setting, a missing install, a time limit and a lint rule. Tell flaky tests from broken ones.

What you will learn

  • Read a failed log in five steps
  • Tell code problems from pipeline problems
  • Fix version, setting, install and time limit failures
  • Tell flaky tests from broken tests

Reading Red Builds

A red build is not a disaster. It is a message.

In this lesson you learn to read that message fast:

  • find the first real error.
  • tell code problems from pipeline problems.
  • fix five failures you will meet at work.
  • tell a flaky test from a broken one.

Simple lesson: most red builds can be fixed in minutes, once you know where to look.

A Real-World Example

Think about a doctor with a patient who has a fever.

  • The fever is the sign. It is not the cause.
  • The doctor asks questions and checks one thing at a time.
  • The doctor treats the cause, not just the fever.

Now map it:

  • Fever = the red ✗ and "exit code 1".
  • Questions and checks = reading the log from the top.
  • The cause = the first real error line.

Simple lesson: "exit code 1" is the fever. Look for the cause above it.

How to Read a Log

Follow these five steps every time:

  1. Open the red step. Ignore the green ones.
  2. Find the $ line. That is the command that ran.
  3. Read down from there to the first line that says error, fail, not found or not set.
  4. Ask: does it name a file and line? A setting? A tool?
  5. Decide: is this a code problem or a pipeline problem?
The error names…It is usually…Fix it in…
A file and line in your codeA code problemYour code
A test that expected X but got YA code problemYour code or the test
A tool "not found"A pipeline problemThe pipeline file
A setting "not set"A pipeline problemThe pipeline file
"canceled" or "exceeded time"A time limitThe pipeline file

On GitHub and Azure, use the search box inside the log. Search for "error" or "fail". It jumps straight to the right lines.

Simple lesson: red step, then $ line, then first error. Every time.

Five Failures You Will Meet

Each lab below starts red. Read the log first. Then fix the file.

1. Wrong Tool Version

  • Your code uses something new.
  • The runner set up an older Node or .NET.
  • The log says a function "is not a function", or the SDK "does not support" your target.

2. A Missing Setting

  • Some code reads a setting, like the address of an API.
  • On your laptop it is in a local file.
  • That file is not in Git, so the runner does not have it.
PlatformGive one job a setting
GitHub Actionsenv: under the job
Azure Pipelinesvariables: under the job

3. Tool Not Found

  • The command needs packages, like vitest or the restored .NET project.
  • The install step is missing, so they are not there.

4. Cancelled for Time

  • Jobs have a time limit. GitHub's default is 360 minutes.
  • Teams often set a small limit, so a stuck job does not waste money.
  • If the limit is too small, a healthy job is stopped.

5. A Style Rule Broke

  • A lint tool checks style rules.
  • Its error names the file, the line and the rule.

Real tools vs this lab: real logs are longer and have timestamps on every line. The order is the same: the command, its output, then the error line. In this lab, the logs are shorter so you can practise the reading.

Simple lesson: versions, settings, installs, time limits and style rules cause most red builds you will see.

Flaky or Broken?

Broken test = fails every time, for the same reason.

Flaky test = sometimes passes, sometimes fails, with the same code.

Signs of a flaky test:

  • It fails 1 run in 10.
  • The error changes each time, often about time or order.
  • It passes alone, but fails with other tests.

What to do:

  • Broken: fix the code or the test. Do not re-run.
  • Flaky: re-run once to unblock, then fix the test soon.
  • Never hide a flaky test by switching off failures.

Pressing "Re-run" on a real failure is how real bugs get merged. Read the log before you re-run. If it fails the same way twice, it is not flaky.

The Flaky Tests lesson in the Testing & Verification course shows how to make them reliable.

Simple lesson: same error every time = broken. Different result each time = flaky.

  1. Make a new branch in your starter repo.
  2. Break the build: add const x: number = "five"; to a source file (React), or int x = "five"; (.NET).
  3. Push and open the failed run.

What you should see: a red typecheck or build step. Find the cause line, not the last line. Then undo the change.

Quick Check

Cheat Sheet

Error textCauseFix
is not a function, NETSDK1045Tool version too oldSet node-version 22 or dotnet-version 10.0.x
API_URL is not setMissing settingenv: (GitHub) or variables: (Azure)
vitest: not found, NETSDK1004No install stepAdd npm ci or dotnet restore
exceeded the maximum execution timeTime limit too smallRaise timeout-minutes or timeoutInMinutes
no-unused-vars, WHITESPACEStyle ruleFix the named line, or run the formatter

GitHub Actions:

jobs:
  build-and-test:
    runs-on: ubuntu-latest
    timeout-minutes: 15
    env:
      API_URL: https://shop-web-staging.azurewebsites.net/api

Azure Pipelines:

jobs:
  - job: build_and_test
    timeoutInMinutes: 15
    variables:
      API_URL: https://shop-web-staging.azurewebsites.net/api

Common mistakes

MistakeWrong ideaCorrect ideaWhat goes wrong
Reading only the last line"exit code 1" is the causeThe first error is the causeYou fix the wrong thing
Re-running every red buildIt will pass next timeRead first, re-run only flaky onesReal bugs get merged
Fixing code for a setup errorAll errors are code errorsTool, setting and time errors live in the fileHours lost in the wrong place
Hiding a flaky testOff is better than redFix or mark it, with a ticketReal failures hide behind it
Tiny time limitsSmaller is saferSet it above your normal run timeHealthy jobs get cancelled

What to Remember

  • Red step, $ line, first error.
  • Names a file and line? Code. Names a tool, setting or time? Pipeline.
  • Most red builds: version, setting, install, time limit, style.
  • Same failure twice = broken. Read before you re-run.

Exercises

Next: Quality Gates on Pull Requests