Skip to content

build: wasip1 is broken on wasmer runtime #59907

Closed

Description

@johanbrandhorst

This is a tracking issue for issues surrounding the use of the new wasip1 GOOS target on the wasmer Wasm runtime. We currently do not have a wasmer runner, but manual testing against the wasmer runtime has already yielded some results, namely, it is known that it exhibits a problem similar to wasmtime when it comes to opening directories (see #59583 (comment)).

This issue should not be considered done until we have a working wasmer runner and all tests are either passing or we have documented the failures which we cannot reasonably fix.

Currently known failing tests:

Package Test name Error Test log Fixed
archive/tar TestReader open testdata/gnu.tar: Bad file number Full log

Activity

  1. added
    arch-wasmWebAssembly issues
    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.
    on May 1, 2023
  2. added this to the Backlog milestone on May 1, 2023
  3. gopherbot commented on May 9, 2023

    @gopherbot
    Contributor

    Change https://go.dev/cl/493755 mentions this issue: all: add wasmer wasip1 runner

  4. gopherbot commented on May 9, 2023

    @gopherbot
    Contributor

    Change https://go.dev/cl/493775 mentions this issue: misc/wasm: add wasmer to wasip1 script

  5. johanbrandhorst commented on May 9, 2023

    @johanbrandhorst
    MemberAuthor

    The runner has been added and once the builders have been redeployed I will run a test run to see what errors we hit.

  6. gopherbot commented on May 16, 2023

    @gopherbot
    Contributor

    Change https://go.dev/cl/495077 mentions this issue: misc/wasm: test commit

  7. johanbrandhorst commented on May 18, 2023

    @johanbrandhorst
    MemberAuthor

    The first runner test result against the wasmer runtime is in, and it seems that it's refusing to do any file opens, instead erroring with Bad file number on practically all attempts. More investigation will be necessary. I have updated the table at the top.

  8. jakebailey commented on May 18, 2023

    @jakebailey
    Contributor

    I'm sure you are aware of this, but if you're looking to just check the current status of the runners, the build dashboard does contain links to the most recent builds per commit (wasip1 is all the way on the right), and should be a more convenient way to look up the current failures than CLs like CL 495077 that need the trybots run. That's how I've been watching things, at least.

  9. johanbrandhorst commented on May 18, 2023

    @johanbrandhorst
    MemberAuthor

    Haha, I didn't actually know that it'd run our broken runners against tip, thanks! I'm still using the CLs to add extra debugging in some cases (like CL 491855) so I'll probably keep them around for myself anyway :).

  10. gopherbot commented on May 26, 2023

    @gopherbot
    Contributor

    Change https://go.dev/cl/498616 mentions this issue: misc/wasm: set PATH variable in exec

  11. added a commit that references this issue on May 26, 2023
  12. tliron commented on Aug 23, 2023

    @tliron

    For what it's worth, I have the same issue, but there is no error when running the same code using wasmtime. The issue seems specific to wasmer.

  13. achille-roussel commented on Aug 23, 2023

    @achille-roussel
    Contributor

    @syrusakbary maybe the wasmer team could help sort out the issue?

  14. arjunmalhotra1 commented on Mar 30, 2024

    @arjunmalhotra1

    Hey @achille-roussel and @johanbrandhorst,
    I will be happy to take a look at this if still unresolved and no one is working on this at the moment.

  15. garciat commented on Feb 11, 2025

    @garciat

    I encountered this issue today with @wasmer/sdk@0.9.0 and Go 1.23.6.

    However wasmer sets up its filesystem, Go is not able to read files from it and fails with Bad file number.

    Gentle ping: @syrusakbary

  16. iamrajiv commented on Dec 7, 2025

    @iamrajiv
    Contributor

    Hi @johanbrandhorst, I checked the Wasmer code and found the issue.

    Wasmer returns ENOTCAPABLE instead of EISDIR when attempting to open the root pre-open without directory rights. Go treats ENOTCAPABLE as a fatal error and does not retry, which results in the Bad file number error.

    Specifically, in the Wasmer code here, it returns ENOTCAPABLE for Kind::Root. Changing this to EISDIR fixes the compatibility issue.

  17. johanbrandhorst commented on Dec 7, 2025

    @johanbrandhorst
    MemberAuthor

    Great job, so the question then is whether this is Wasmer implementing the spec incorrectly or whether Go needs to handle this case differently. Has your research shed any light on which it is?

  18. iamrajiv commented on Jan 2, 2026

    @iamrajiv
    Contributor

    Hi @johanbrandhorst, sorry for the delay!

    Based on my investigation, this is a Wasmer bug, not a Go issue. I've submitted a fix: wasmerio/wasmer#6009

    There were actually three issues in Wasmer:

    1. fd_prestat_get reported incorrect pr_name_len - Wasmer returned name.len() + 1, including a null terminator in the length. The WASI spec says pr_name_len should be the exact path length without null terminator. This caused Go to read preopen names like "/\x00" instead of "/", breaking path prefix matching entirely.
    2. fd_prestat_dir_name had an off-by-one in buffer check - the condition name.len() < path_len was too strict, returning EOVERFLOW for exact-size buffers. Changed to <=.
    3. path_open returned wrong error for root directory - Wasmer returned ENOTCAPABLE instead of EISDIR when opening root without O_DIRECTORY. Go's retry logic handles EISDIR specifically to retry with proper directory flags.
  19. iamrajiv commented on Apr 1, 2026

    @iamrajiv
    Contributor
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

    NeedsInvestigationSomeone must examine and confirm this is a valid issue and not a duplicate of an existing one.arch-wasmWebAssembly issues

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions