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.
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
