Skip to content

bug(node): NAPI_RS_FORCE_WASI=false triggers WASI fallback due to truthy string check #3267

Description

@tryweb

Description

Setting NAPI_RS_FORCE_WASI=false as an environment variable causes lancedb to attempt loading the non-existent lancedb.wasi.cjs file, resulting in initialization failure.

Error

initialization deferred: ENOENT: no such file or directory, open '.../@lancedb/lancedb/dist/lancedb.wasi.cjs'

Root Cause

In native.js around line 607:

if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI)

The string "false" is truthy in JavaScript, so NAPI_RS_FORCE_WASI=false inadvertently triggers the WASI loading path.

Expected Behavior

NAPI_RS_FORCE_WASI=false should NOT trigger the WASI fallback. The check should explicitly compare against the string "true", e.g.:

if (!nativeBinding || process.env.NAPI_RS_FORCE_WASI === 'true')

Workaround

  • Unset NAPI_RS_FORCE_WASI entirely instead of setting it to false

Environment

  • lancedb: @0.27.2
  • Node.js: v24.3.0
  • OS: Linux (also reproducible on other platforms)

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