GitHub Copilot

Verified against GitHub Copilot Chat · 2026-07-27

Get Copilot to explain a terminal failure using the actual run, not the command in isolation

A prompt for the @terminal chat participant that pulls in the integrated terminal's real output, exit behavior, and last-known-good state so Copilot diagnoses what this specific run did, not what the command usually does when it works.

GitHub Copilot Chat (VS Code)5 fillable variables

The prompt

Ready to copy — highlighted parts are example details you can swap.

@terminal this command just failed and I want to know why it failed on this specific run, in
this specific environment — not a general explanation of what this command normally does.

COMMAND
npm run build

WHAT ACTUALLY CAME BACK
Module not found: Can't resolve '@/lib/reports/format' in './components/reports/ReportSummary.tsx'

WHAT I EXPECTED INSTEAD
This built successfully yesterday on the same branch with no changes to tsconfig.json or the lib/reports directory.

ENVIRONMENT
Git Bash on Windows 11, Node 20, running inside a pnpm workspace.

WHAT WAS LAST KNOWN TO WORK
Last known good commit is a3f21c9, before a rename of lib/reports/format.ts to lib/reports/formatting.ts.

Answer in this order:
1. Read the actual output above line by line and point to the specific line that indicates the
   real failure — not the last line printed, which is often just the shell's own exit report, but
   the line where the underlying tool first signals something went wrong.
2. State what that specific line means in the context of Git Bash on Windows 11, Node 20, running inside a pnpm workspace., naming the exact
   condition — a missing binary, a permission bit, a wrong working directory, an environment
   variable that is unset or pointing somewhere unexpected — rather than a general category like
   'a configuration issue.'
3. Compare against Last known good commit is a3f21c9, before a rename of lib/reports/format.ts to lib/reports/formatting.ts. and say what is different now that would explain why
   this used to work and does not now, if that information was given — do not skip this step just
   because it requires more inference than restating the error.
4. Propose one command to run next that would confirm your diagnosis before proposing any fix — a
   diagnostic command, not the fix itself, since a fix based on an unconfirmed guess about a
   terminal failure risks masking the real cause instead of resolving it.

Do not suggest reinstalling, clearing a cache, or restarting anything as a first move unless the
output above specifically points there — those are the shotgun fixes that work by accident often
enough to keep getting suggested, and this diagnosis should not default to one.

IF THE SHELL MATTERS
If Git Bash on Windows 11, Node 20, running inside a pnpm workspace. indicates something other than a standard POSIX shell — PowerShell, a
Windows Git Bash session, a shell running inside a container with a different filesystem than the
host — say explicitly whether the failure is specific to that shell's own quoting, path, or
line-ending behavior before assuming the command would behave the same way in a different shell. A
command copied from a POSIX-shell example failing on this run is frequently a shell mismatch, not
a broken command.

Customize

Optional — swap in your own details for the highlighted parts above.

Why this works

The @terminal chat participant is specifically grounded in the integrated terminal's own state — its shell type and recent output — which is the mechanism this prompt actually exploits by pasting the real output and exit behavior directly into the question, rather than asking a bare why did this fail with no evidence attached; a question with no attached output gives Copilot nothing to diagnose against except the command text itself, and it will answer the easier, more generic question that text alone supports. Distinguishing the last line printed, which is very often just the shell's own exit report, from the line where the underlying tool first signals a real problem is a genuine and common parsing distinction in failed command output — a build tool, a bundler, or a test runner typically emits its actual error several lines before a wrapping shell or process manager prints its own generic failed with exit code message, and treating the last line as the diagnosis skips past the line that actually explains anything. The instruction to suppress shotgun fixes — reinstall, clear the cache, restart — unless the output specifically points there targets a well-known pattern in troubleshooting advice generally, not just AI-generated advice: these fixes work often enough, by accident, across a wide enough range of unrelated problems that they get suggested reflexively, and suppressing that reflex forces a diagnosis actually grounded in the pasted evidence rather than a plausible-sounding default. The shell-mismatch check exists because a command's behavior is not portable across shells in ways that are easy to overlook — quoting rules, path separators, and line-ending handling genuinely differ between a POSIX shell and PowerShell or a Windows Git Bash session, so a command that is entirely correct in the shell it was written for can fail in a different one for a reason that has nothing to do with the command's logic at all, and naming the shell explicitly is what lets that specific failure category even be considered.

What you get back

1. The real failure is the line reporting the module could not be found — not the generic build failed line printed last. 2. The module was renamed to formatting.ts in a recent commit but one import in ReportSummary.tsx was not updated to match. 3. Comparing to commit a3f21c9 confirms the rename happened after that commit, explaining why the build succeeded then. 4. Confirm by searching for every remaining import of the old format.ts path before assuming this is the only broken reference.

Verified against

GitHub Copilot Chat Copilot Chat 1.270 (VS Code, @terminal) · 2026-07-27

Changelog

  • 2026-07-27 Initial publish, verified against Copilot Chat 1.270 (VS Code) with @terminal.

Need this built into your business?

If a prompt isn't enough — custom software, built and maintained for you — that's Scult's day job.

EXPLORE CUSTOM SOFTWARE
Write a .github/copilot-instructions.md file Copilot actually followsA repository-wide custom-instructions file that Copilot loads automatically into every Chat request, code-review pass, coding-agent session, and commit or PR-description generation in this repo, written so each rule holds up standing alone instead of only in the context it was written in.GitHub Copilot Chat (VS Code)GitHub Copilot code review2026-07-20Scope Copilot's instructions to one directory with an applyTo instructions fileA path-scoped .github/instructions/*.instructions.md template using the applyTo frontmatter glob, so a directory-specific rule — a different test framework, a stricter API contract, a legacy pattern that must not spread — applies only where it is actually true instead of polluting the repo-wide instructions file.GitHub Copilot Chat (VS Code)GitHub Copilot coding agent2026-07-21Define a custom Copilot Chat mode instead of re-explaining your workflow every sessionA .github/chatmodes/*.chatmode.md definition — scoped tools, a fixed model, and a narrow system prompt — that turns a repeated review-and-plan style of conversation into a mode you switch into once, instead of a persona you re-describe in the first message every time.GitHub Copilot Chat (VS Code)2026-07-22Turn a prompt you keep retyping into a Copilot prompt file instead of pasting it againA .github/prompts/*.prompt.md reusable prompt file with input placeholders, invoked as a slash command from the Chat input box, so a well-tuned multi-paragraph prompt becomes one command instead of a paste you have to keep re-finding.GitHub Copilot Chat (VS Code)2026-07-22
All GitHub Copilot prompts

Check your AI visibility

One URL in, a 0–100 score and the exact fixes out.

RUN THE CHECK

Browse all the tools

15 tools across six categories
13 of them never send your data anywhere

Free · No signup · No trial clock

SEE THE DIRECTORY