How to Fix Astro Errors With Claude or ChatGPT
A simple method for getting an AI to fix an Astro error on the first try: what to paste, what to say, and what to check before you trust the fix.
Tested on Astro 7.4

In this guide
AI tools are good at errors, because an error message is precise. The trick is giving them the exact message instead of a description of it.
The method
1. Copy the whole error
Select everything from the first line of the error to the last, including the file path and line number. Don’t retype it, and don’t trim it.
2. Paste it with the file
Use this shape:
I'm on Astro 7.4. When I run npm run dev I get this error:
[paste the error]
Here's the file it mentions:
[paste the file]
What's wrong, and what's the corrected file?
The version matters. Several errors mean different things in different Astro versions.
3. Read the explanation before the code
A good answer tells you why the error happened. If it only gives you code, ask “why did that happen?” You’ll avoid the same error next week.
4. Apply the fix and run again
Paste the corrected file, save, and check. If you get a new error, paste that one. Second rounds are normal.
The errors AI fixes well
- Unclosed tags. “Expected corresponding JSX closing tag” is instant for an AI.
- Wrong paths. “Could not resolve” errors, where a folder name is misspelled.
- Missing fields. “title: Required” from a content collection.
The errors to be careful with
- Outdated advice. If the fix involves
src/content/config.ts,ViewTransitionsor@astrojs/tailwind, the AI is reaching for old Astro. See mistakes AI makes with Astro. - “Just delete it.” Removing the thing that errors makes the error go away and the feature with it. Ask what the line was for.
With a coding agent
In Claude Code or Codex, you can skip the pasting. Say “run npm run build and fix any errors”, and the agent reads the output itself. Still read what it changed.
If you’d rather not use AI
Our common Astro errors guide covers the six errors beginners hit most, with the fix for each.
Frequently asked questions
Should I paste my whole project into the AI?
No. Paste the error and the file it names. If the AI needs more, it will ask. A coding agent like Claude Code can read the project itself.
What if the AI's fix causes a different error?
Paste the new error. That's normal, and usually the second answer lands. If you go round three times, step back and read our common errors guide.
Stuck on a step?
Check the common errors guide, look up a word in the glossary, or ask in the official Astro Discord, where the support channels are friendly to beginners.