{"record":{"id":"a6c305df13d9f446","repo":"vercel/next.js","slug":"invalid-link-with-a-child-please-remove-a-o","errorCode":null,"errorMessage":"Invalid <Link> with <a> child. Please remove <a> or use <Link legacyBehavior>.\nLearn more: https://nextjs.org/docs/messages/invalid-new-link-with-extra-anchor","messagePattern":"Invalid <Link> with <a> child\\. Please remove <a> or use <Link legacyBehavior>\\.\nLearn more: https://nextjs\\.org/docs/messages/invalid-new-link-with-extra-anchor","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/next/src/client/app-dir/link.tsx","lineNumber":592,"sourceCode":"        if (!children) {\n          throw new Error(\n            `No children were passed to <Link> with \\`href\\` of \\`${formattedHref}\\` but one child is required https://nextjs.org/docs/messages/link-no-children`\n          )\n        }\n        throw new Error(\n          `Multiple children were passed to <Link> with \\`href\\` of \\`${formattedHref}\\` but only one child is supported https://nextjs.org/docs/messages/link-multiple-children` +\n            (typeof window !== 'undefined'\n              ? \" \\nOpen your browser's console to view the Component stack trace.\"\n              : '')\n        )\n      }\n    } else {\n      child = React.Children.only(children)\n    }\n  } else {\n    if (process.env.NODE_ENV === 'development') {\n      if ((children as any)?.type === 'a') {\n        throw new Error(\n          'Invalid <Link> with <a> child. Please remove <a> or use <Link legacyBehavior>.\\nLearn more: https://nextjs.org/docs/messages/invalid-new-link-with-extra-anchor'\n        )\n      }\n    }\n  }\n\n  const childRef: any = legacyBehavior\n    ? child && typeof child === 'object' && child.ref\n    : forwardedRef\n\n  // Capture the Owner Stack during render so dev-only warnings emitted later\n  // at navigation time can be associated with the JSX that created\n  // this <Link>.\n  const ownerStack =\n    process.env.NODE_ENV !== 'production' && process.env.__NEXT_CACHE_COMPONENTS\n      ? // eslint-disable-next-line react-hooks/rules-of-hooks -- build time variables\n        React.useMemo(() => {\n          // Only capture when a warning might actually need it. Otherwise leave","sourceCodeStart":574,"sourceCodeEnd":610,"githubUrl":"https://github.com/vercel/next.js/blob/0eb377541648e63402a47b38fee00a8d0ce8f8f1/packages/next/src/client/app-dir/link.tsx#L574-L610","documentation":"LinkComponent throws when the single child of a <Link> without legacyBehavior is a plain <a> element, which would nest an anchor inside the anchor Next.js renders. Either remove the <a> or opt into legacyBehavior to own the anchor yourself.","triggerScenarios":"<Link> contains a raw <a> child without legacyBehavior.","commonSituations":"Nesting <a> inside the new Link; remove the anchor or add legacyBehavior.","solutions":["Remove the nested <a> child, or add legacyBehavior to <Link>."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"0eb377541648e63402a47b38fee00a8d0ce8f8f1","analyzedAt":"2026-08-19T02:10:13.922Z","contentChangedAt":"2026-08-19T02:10:13.922Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}