Skip to content

Next.js: removed script bodies can enqueue missing Flight placeholders #1441

Open

Description

@ChristianPavilonis

Report

Aram identified this pre-existing case while reviewing #1222:
#1222 (comment)

When an attribute rewriter removes a script element, lol_html still invokes its text handler. If the removed body contains a Flight push, the Next.js stage queues a placeholder that never reaches output. A later Flight script then fails the response with:

Next.js RSC output contains an unknown generated placeholder

Example shape, with an attribute rewriter configured to remove the first script:

<script src="https://cdn.example.com/prebid.js">self.__next_f.push([1,"0:{\"url\":\"https://origin.example.com/a\"}\n"])</script>
<script>self.__next_f.push([1,"0:{\"url\":\"https://origin.example.com/b\"}\n"])</script>

Aram reproduced this on main and the PR, with Next.js alone and with GTM, across all 174 two-way splits of his fixture. Browsers ignore inline bodies on scripts with a src, and Next.js does not normally emit this shape. This issue records his reproduction; it has not been independently rerun during the review-thread follow-up.

Expected behavior

Removed elements must not enqueue Flight placeholders that cannot be emitted. Skip composed script stages for removed elements, or otherwise prevent their capture state from reaching the output stage.

Verification

Add a full HTML-processing regression with a removed script followed by a real Flight push. Cover Next.js alone and mixed Next.js/GTM, fragment boundaries, complete output, and no unresolved placeholders. Keep existing strict errors for genuinely lost placeholders.

Activity

  1. added theissue type on Oct 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions