Fix a build error at the root cause

Paste a build error; Claude Code reproduces it, fixes the root cause without suppressing the error, and shows the build and tests passing again.

Task: Fix a build error at the root cause · Other tasks

Fill in the details

Copy it from your terminal or the CI log. Remove secrets and tokens first.

Optional. Leave empty and Claude will find how the project builds.

Optional. A dependency upgrade, a merge, a config edit, or "nothing I know of".

Copy your prompt

This site doesn't run Claude or show model output. Results depend on your input and the model you use.

1 required field is empty.

What you type is kept in this tab's session storage so a reload doesn't lose it. Use "Clear this task" to remove it. Browsers can restore session data when they reopen tabs, so closing a tab isn't a guaranteed way to erase it.

When to use this template

  • The build is failing, locally or in CI, and you want the cause fixed rather than the error message silenced.
  • You have the error output in front of you. Paste it into the field, or inside Claude Code type @ and reference a saved log file so Claude reads it directly.
  • The break followed a known change, such as a dependency or compiler upgrade, and you want Claude to work out what that change requires from the code.

When not to use it

  • The build fails only on a CI runner with settings Claude Code cannot reproduce on your machine. Paste the output and expect a diagnosis; confirm the fix on CI.
  • A specific test fails while the build itself succeeds. Use the failing test template, which starts by running that test.
  • You need a working build right now to ship an urgent fix. Revert the change that broke it first, then use this prompt to fix the cause properly.

Why this structure

  • The full error goes first inside <build_error> tags, which separate the build output from the task itself, so Claude works from the actual output instead of your summary of it. Tags do not neutralize text hidden in a log, so review what you paste.
  • Step 1 asks Claude to reproduce the failure. If it cannot, the difference between environments is the real finding, and a fix made without reproducing it would be a guess.
  • Step 2 points at the first real error, because one broken type or import can produce a long cascade of later errors that disappear once it is fixed.
  • Step 3 lists the common ways to suppress an error, such as ignore comments, disabled checks and looser settings, and rules them out, so a fix of that kind needs your approval first.
  • The dependency rule asks Claude to check with you before adding or changing a dependency, so a build fix does not quietly grow into an upgrade project.
  • Step 5 runs the build and then the tests. The build succeeding is the check Claude iterates against; the tests show the fix did not break behavior elsewhere.

Example input (fictional)

Build error output
src/reports/export.ts:42:18 - error TS2345: Argument of type 'string | undefined' is not assignable to parameter of type 'string'.

42   formatDate(row.closedAt, tz)
                    ~~~~~~~~~~~~

Found 1 error in src/reports/export.ts:42
Build command
npm run build
What changed before it broke
Upgraded the TypeScript compiler from 5.4 to 5.6

Follow-ups to send Claude

  • Are there other places in the code with the same pattern that will break the same way? List them without changing anything.
  • Explain what changed in the compiler upgrade that caused this, in a few sentences I can put in the pull request.
  • Add a check to CI that would have caught this before merge, and show me the change before applying it.

Common mistakes

  • Pasting only the last line of the build output. The first error, with the lines just before it, usually says more than the final summary.
  • Accepting a fix that adds an ignore comment or loosens a setting. Read the diff; if the fix suppresses the error, ask for the root cause again.
  • Leaving out what changed just before the break. A recent upgrade or merge often explains the error at once.
  • Debug an error: Turn an error message and the code around it into a ranked list of likely causes, a check for each, and a fix you can try.
  • Find and fix a failing test: Name the failing test; Claude Code runs it, traces the failure into the source, explains the cause, fixes it and shows the passing test output.
  • Write a GitHub Actions CI workflow: Have Claude Code write a GitHub Actions workflow from your project's own build and test commands, with secrets referenced by name and nothing pushed.

See all templates

Sources