`wasmtime compile --emit-clif` and `wasmtime hot-blocks` panic on components (NotFound when creating a CLIF file)

Open Beginner friendly
#15,536 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
78/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Active
Tech stack
rust, wasm

Research direction

Start in crates/cranelift/src/compiler.rs at the CLIF filename construction and file creation mentioned in the report. Reproduce with a wasm32-wasip2 component using wasmtime compile --emit-clif or wasmtime hot-blocks; compare with a core module. Done when component compilation no longer panics on symbol paths and file creation errors are reported.

Written by the indexing model from the issue text.

Description

bug

Thanks for filing a bug report! Please fill out the TODOs below.

Note: if you want to report a security issue, please read our security policy!

Test Case

Any component triggers it, so no file is attached. A default hello world is enough:

$ cargo new hello && cd hello
$ cargo build --target wasm32-wasip2
Steps to Reproduce
  • mkdir clif-out
  • wasmtime compile --emit-clif clif-out -o out.cwasm target/wasm32-wasip2/debug/hello.wasm
  • Or: wasmtime hot-blocks target/wasm32-wasip2/debug/hello.wasm
Expected Results

CLIF files are written for all functions and compilation succeeds, as it does for a core module. If a file cannot be written, an error is reported instead of a panic.

Actual Results

Both commands panic and the process aborts (exit code 134):

thread '<unnamed>' panicked at crates/cranelift/src/compiler.rs:1641:58:
called `Result::unwrap()` on an `Err` value: Os { code: 2, kind: NotFound, message: "No such file or directory" }
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

For the hello world, 18 CLIF files are written to clif-out before the panic. The same program built for wasm32-wasip1 (a core module) compiles fine with --emit-clif: 289 CLIF files, exit code 0.

Versions and Environment

Wasmtime version or commit: 47.0.3 (5554cc1a6 2026-07-31). The code involved is unchanged on main (checked 2026-12-03).

Operating system: Linux (Ubuntu 22.04)

Architecture: x86_64

Extra Info

Likely cause: in crates/cranelift/src/compiler.rs, the CLIF file name is derived from the function symbol by replacing only : (path.join(symbol.replace(":", "-"))), and the file is then created with std::fs::File::create(path).unwrap(). Component symbols can include interface names such as wasi:cli/[email protected], so a / remains and path.join points into a subdirectory that does not exist. Sanitizing path separators in the file name (or creating parent directories), and returning the I/O error instead of calling unwrap(), would avoid the panic.

Dominant language
Rust
Stars
18.9k
Forks
2k
Avg merge
1d 6h
Merged PRs (30d)
238

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from bytecodealliance/wasmtime

All issues in bytecodealliance/wasmtime

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.