Free Astro tutorials for complete beginners.

Beginner's Guide to Astro

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

Cover image for How to Fix Astro Errors With Claude or ChatGPT
In this guide
  1. The method
  2. The errors AI fixes well
  3. The errors to be careful with
  4. With a coding agent
  5. If you’d rather not use AI
  6. Frequently asked questions

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, ViewTransitions or @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 the friendly people in the official Astro and EmDash Discords. How to ask so people can help.

Keep reading

  1. How to Get Your Astro Site Cited by ChatGPT, Claude and Google AI

    AI assistants answer with links. What makes a site easy for them to read and cite: clear pages, structured data, a sitemap, Bing and llms.txt. Honest about what's proven.

    Build with AI, 7 minute read, November 8, 2026

  2. How to Build an Astro Website With Gemini

    Use Google's Gemini to build an Astro site, in the free chat or with Antigravity, Google's coding agent that replaced the Gemini CLI in 2026.

    Build with AI, 7 minute read, November 7, 2026

  3. Can I Build an Astro Site With Grok, Kimi, DeepSeek or Qwen?

    Yes. Any AI chat can write Astro code for you. Here's the method that works with all of them, and which ones also have a coding agent that edits your project.

    Build with AI, 7 minute read, November 7, 2026

Try "blog", "deploy" or "EmDash".