AI & Agent Dev Bug Sandbox logo
AI & Agent Dev Bug Sandbox
Back to Radar

Static Metadata Rendered In <Body> Instead Of <Head> In Next.Js 15.5.4

In Next.js 15.5.4, metadata defined via 'export const metadata' is incorrectly rendered inside <body> instead of <head>, breaking Open Graph, Twitter Cards, and SEO. Downgrading to 15.2.4 restores correct behavior.

highConfidence 75%Next.jsnext buildApp RouterAffected V15.5.4

Origin Analysis

Regression in Next.js 15.5.4 likely introduced when updating React 19.2.0 support or metadata streaming logic. The metadata hoisting mechanism that should inject metadata into <head> is failing, causing the tags to remain in the component tree and be rendered in <body>. Likely an internal ordering or Suspense boundary issue in the app-render pipeline.
1. Clone https://github.com/fabiotheo/nextjs-metadata-bug 2. Run npm install and npm run dev 3. Open http://localhost:3000 and inspect HTML in DevTools 4. Observe that custom meta tags (og:title, fb:app_id, twitter:card) appear inside <body> instead of <head>

Fixing Code Block

Edge Case Audit

Manual metadata in <head> deviates from Next.js best practices and will not support dynamic metadata, image generation, or automatic canonical URLs. If you keep the export const metadata, duplicate tags may appear. After upgrading to a fixed version, remove this manual block and restore the Metadata API. Rollback to 15.2.4 is also a safe alternative.

Ecosystem Topology

Agent Frameworks

LangChain, LlamaIndex, and Pydantic

  1. highProperty graph relation keys collide when entity IDs or labels contain underscores
  2. highCodeActAgent drops assistant tool-call metadata during handoff, leaving an orphan tool response
  3. high[Bug]: HierarchicalNodeParser async methods return the documents unsplit
  4. highLLM.predict_and_call fails with ValidationError for non-function-calling models when react_chat_formatter is omitted
  5. highAnthropic streaming server-tool input_json_delta overwrites completed client tool_use arguments due to stale cur_tool_call state