You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
codegen(wasm): an extern lowered to WASI is also emitted as an unsatisfiable env import (e.g. env.clock_now_ms) #851
architectureStructural/system-level shape and runtime behaviourbindingsABI, FFI, WASM, and cross-language interop surfacesbugSomething is broken or behaves incorrectlyenhancementNew capability or improvement to existing behaviourpriority:p2Normal - queue itscope:repoConfined to this repositorystatus:readyFully specified and ready to be picked up
The compiled module's imports are wasi_snapshot_preview1.fd_write, wasi_snapshot_preview1.clock_time_get and env.clock_now_ms. The call itself is lowered to WASI clock_time_get, so the env import is unused. bun run then fails with import env:clock_now_ms must be an object. Re-verified on main-based build 161eaaf; the same happens on main without PR #841.
Fix: when an extern is lowered by a WASI intrinsic arm, do not also emit it as an env import. Check the same for the other WASI-lowered externs (env_*, arg_*, file_*, net_*).
Problem: When an extern such as clock_now_ms is lowered to a WASI intrinsic (clock_time_get), core wasm codegen also emits it as an env import. In the repro, env.clock_now_ms is emitted but never used. A WASI-only host cannot satisfy that import, so instantiation fails (bun run: import env:clock_now_ms must be an object). Seen on 161eaaf and on main without PR #841.
Expected: Externs lowered by a WASI intrinsic arm emit no env import. The same holds for the env_*, arg_*, file_* and net_* externs.
architectureStructural/system-level shape and runtime behaviourbindingsABI, FFI, WASM, and cross-language interop surfacesbugSomething is broken or behaves incorrectlyenhancementNew capability or improvement to existing behaviourpriority:p2Normal - queue itscope:repoConfined to this repositorystatus:readyFully specified and ready to be picked up
Activity
whatproblem-ai commentedon Dec 1, 2026
Problem: When an
externsuch asclock_now_msis lowered to a WASI intrinsic (clock_time_get), core wasm codegen also emits it as anenvimport. In the repro,env.clock_now_msis emitted but never used. A WASI-only host cannot satisfy that import, so instantiation fails (bun run:import env:clock_now_ms must be an object). Seen on161eaafand onmainwithout PR #841.Expected: Externs lowered by a WASI intrinsic arm emit no
envimport. The same holds for theenv_*,arg_*,file_*andnet_*externs.Missing: exact compile command/target flags
Clarity: 92%. Clear enough to work on.
⌨️ Commands · 💬 Have feedback? Tell us · 🎯 New here? Add WhatProblem to your repo · 🔒 Privacy