Description
What happened
Using the documented global Fetch API on Windows compiles successfully, but the generated binary runs with runtime no-op stubs instead of the real perry-stdlib fetch implementation. At runtime, response.json() fails with Error: Invalid response handle.
The runtime prints these warnings before the error:
[perry] warning: `js_stdlib_init_dispatch` is a no-op stub on this platform — stdlib dispatch symbol from perry-stdlib not linked into this binary (runtime-only build)
[perry] warning: `js_fetch_with_options` is a no-op stub on this platform — fetch symbol from perry-stdlib not linked into this binary (runtime-only build)
Error: Invalid response handle
at <anonymous>
What you expected
The documented global fetch(...) example should link the real perry-stdlib fetch implementation on Windows. await fetch(...) should return a valid Response, await response.json() should parse the body, and result.status should contain the HTTP status code.
Minimal reproduction
// GET request
const response = await fetch("https://jsonplaceholder.typicode.com/posts/1");
const data = await response.json();
// POST request
const result = await fetch("https://jsonplaceholder.typicode.com/posts", {
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({ title: "hello", body: "world", userId: 1 }),
});
console.log(`fetch ok: ${data !== null} status=${result.status}`);Command you ran:
perry compile src/main.ts -o main.exe
./main.exeEnvironment
- Perry version:
perry 0.5.1129 - Host OS: Microsoft Windows 11 Pro
- Target: native Windows
- Rust toolchain (if building from source): not applicable
- Installed via: winget (
winget install PerryTS.Perry)
Diagnostic output
Runtime output:
[perry] warning: `js_stdlib_init_dispatch` is a no-op stub on this platform — stdlib dispatch symbol from perry-stdlib not linked into this binary (runtime-only build)
[perry] warning: `js_fetch_with_options` is a no-op stub on this platform — fetch symbol from perry-stdlib not linked into this binary (runtime-only build)
Error: Invalid response handle
at <anonymous>
perry check --check-deps src/main.ts passes for the minimal reproduction, but the compiled binary appears to use runtime-only stubs for fetch/stdlib dispatch.
Anything else
This looks related to Windows final linking / stdlib symbol selection rather than a JavaScript-level fetch error. It is not the same as #732 (winhttp.lib missing), but it seems similar in that the Windows final binary does not get the expected native stdlib implementation.
I also saw this in a perry/ui app: fetch only resumed after another UI/timer event, and the returned response had status=0; response.json() / response.text() then failed with Invalid response handle. A CLI-only minimal reproduction above is enough to show the stub-linking problem.
Activity
senluowx commentedon Jun 15, 2026
Update: I tested this again with Perry
0.5.1167installed via winget, and the issue still reproduces withoutPERRY_WORKSPACE_ROOT.The winget installation contains the prebuilt libraries:
So this does not appear to be a missing stdlib file. The compiler also prints:
However, the Windows linker reports duplicate symbols between
perry_runtime.libandperry_stdlib.lib, for example:The resulting executable still calls the runtime no-op stubs:
I also found a workaround. If I set
PERRY_WORKSPACE_ROOTto a local Perry source checkout and force a rebuild, the generated executable works correctly:Output:
During this working build, Perry prints:
So the issue seems specific to the winget/prebuilt Windows runtime+stdlib link path. When runtime+stdlib are rebuilt from source via
PERRY_WORKSPACE_ROOT,fetchresolves to the real stdlib implementation and works.This suggests the problem may be related to Windows prebuilt archive symbol resolution, duplicate symbol handling, or link order between
perry_runtime.libandperry_stdlib.lib.jroweboy commentedon Jun 16, 2026
I linked back to this in another issue, but I've encountered this bug as well, and its not limited to just
fetch. It was happening for me withprocess.stdinon windows also.fix(compile): Windows global fetch links real stdlib impl (#5000); no…
merge origin/main into fix/windows-fetch-stub-link
fix(compile): Windows global fetch links real stdlib impl (#5000); no…
fix(compile): generalize #5000 stdlib-stub localization to macOS/Linu…
fix(link): #5892 — keep perry_ffi test shims out of production ext ar…
fix(link): stop --whole-archive'ing the stdlib on the Linux GTK4 UI p…