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 in the official Astro Discord, where the support channels are friendly to beginners.

Keep reading

  1. How to Build an Astro Website With Claude (Step by Step)

    Use Claude to build a real Astro site, in the chat at claude.ai or with Claude Code in your terminal. This very site was built that way.

    Build with AI, 9 minute read, November 6, 2026

  2. How to Build an Astro Website With ChatGPT

    Use ChatGPT to build an Astro site, either by chatting and pasting code, or with Codex, OpenAI's coding agent that works inside your project.

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

  3. How to Build an EmDash Site With Claude or ChatGPT

    EmDash projects ship with files made for AI coding tools. Here's how to use Claude Code or Codex to customize an EmDash site without writing the code yourself.

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

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