Skip to content

regression(hir): Coop's Next.js fixture throws nameless ReferenceError: identifier is not defined at init on 0.5.1519 — loaded on 0.5.1516 #8882

Description

@proggeramlug

Summary

The Coop Next.js benchmark fixture (a production next build --webpack App Route compiled through Coop, benchmarks/next-small in PerryTS/coop) loads and serves on Perry 0.5.1516 (3885ba491) — that is the build every #8546 measurement was taken on — and on 0.5.1519 (41e8479a5) it dies at module init, before any request:

daemon: ReferenceError: identifier is not defined
daemon:     at <anonymous>

One application is enough; this is not the multi-heap case. Coop's daemon exits during preload with status 1, so #8546 cannot currently be reproduced on main at all.

What it is not

Where the throw can come from

The message is the nameless form (js_throw_reference_error_unresolved_get). Its HIR emitters on 41e8479a5:

  • crates/perry-hir/src/lower_decl/helpers.rs:189, 204, 214, 218 (and the _unresolved_assignment sibling at 197)
  • crates/perry-hir/src/lower/expr_new.rs:1599

Between 3885ba491 and 41e8479a5 (127 commits) the HIR commits that touch binding/scope resolution are the first suspects:

Reproduction

PerryTS/coop main at 3e7180e (pin 0.5.1519, rust-toolchain.toml = nightly-2026-08-20):

scripts/build-perry-libraries.sh
cargo build --release -p coop-daemon -p coop-worker
scripts/prepare-next-benchmark.sh            # next build --webpack, then the daemon compiles it (see the compile-time issue: budget with COOP_NEXT_COMPILE_TIMEOUT)
APP=$(find target/next-benchmark/coop-run/compiled/next-bench -name app.dylib | head -1)
COOP_BENCH_APP_COUNTS=1 COOP_BENCH_EXECUTION_MODE=in_process COOP_BENCH_APP_LIBRARY="$APP" \
  cargo test --release -p coop-daemon --test resource_benchmark measure_in_process_startup_and_rss -- --ignored --nocapture

Same steps with perry-main.lock at 3885ba491 load the application (the #8546 runs).

The ask, again

#8730 asked for it and it is still the blocker for this class: name the identifier in the message. at <anonymous> with no name means the only way to attribute this is to instrument the five throw sites and recompile the bundle, which for this fixture is a multi-hour build on 0.5.1519. A name would make it a two-minute bisect.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions