Next.js 15: Invalid <Link> with <a> child
Error: Invalid <Link> with <a> child. Please remove <a> or use <Link legacyBehavior>.
Learn more: https://nextjs.org/docs/messages/invalid-link-with-a-child
Immediate Remediation
jsx
// Before <Link href="/about"><a>About</a></Link> // After <Link href="/about">About</Link>
Root Cause Analysis
In Next.js 13+ App Router, next/link renders its own anchor element, so wrapping it in an <a> tag creates invalid nested anchors and triggers this error.
Verification & Guardrails
- If you are on Next.js 12 or earlier, use legacyBehavior to keep the <a> child.
- This error appears during both build and runtime.
- Ensure all Link components have a single child that is not an <a> element.
Have a custom or uncategorized crash?
Run your trace through our in-memory client privacy sandbox for instant SRE remediation.