Skip to content

Windows processcontainer: Bun exits 66 with no stderr; PATH env causes CreateProcessW error #483

@laz-jamesfuller

Description

@laz-jamesfuller

Summary

On Windows with @microsoft/mxc-sdk@0.6.1, processcontainer can successfully execute a simple PowerShell command, but attempting to execute Bun through the same SDK runner exits nonzero with no stderr. I also hit a separate env handling failure when passing the host PATH through the SDK env parameter.

This may be a Bun/runtime compatibility issue, but the current failure mode is hard to diagnose.

Environment

  • OS: Windows
  • SDK: @microsoft/mxc-sdk@0.6.1
  • Containment: process resolving to processcontainer
  • Spawn mode: spawnSandboxFromConfig(..., { usePty: false })

getPlatformSupport() reported:

{"isSupported":true}

The local capability wrapper resolved the backend as processcontainer.

What worked

Running PowerShell inside the MXC process container worked:

await runner.exec(
  "C:/Windows/System32/WindowsPowerShell/v1.0/powershell.exe",
  ["-NoLogo", "-NoProfile", "-Command", "Write-Output mxc-smoke"],
  {
    cwd: tempDir,
    readonlyPaths: ["C:/Windows/System32"],
    readwritePaths: [tempDir],
    timeoutMs: 30_000,
  },
);

Result:

{"stdout":"mxc-smoke\r\n","stderr":"","code":0}

What failed

Running Bun through the same runner failed:

await runner.exec(
  process.execPath,
  ["-e", "console.log('mxc smoke')"],
  {
    cwd: tempDir,
    readonlyPaths: [process.execPath],
    readwritePaths: [tempDir],
    timeoutMs: 30_000,
  },
);

Result:

{"stdout":"","stderr":"","code":66}

There was no stderr or diagnostic text explaining whether this is expected, unsupported, missing filesystem access, env-related, or a child runtime failure.

Env-related failure

Before removing inherited PATH, passing PATH via the SDK env parameter produced:

Process error: CreateProcessW failed: The system could not find the environment option that was entered. (0x800700CB)
{"error":{"code":"backend_error","message":"Process error: CreateProcessW failed: The system could not find the environment option that was entered. (0x800700CB)"}}

That may be expected if PATH contains entries that are invalid inside the container, but it would be useful for the SDK/backend to document or diagnose that case clearly.

Expected behavior

Either:

  • Bun works under Windows processcontainer when the executable path is readable and no broad env is passed, or
  • MXC reports a clearer diagnostic explaining why that runtime cannot start in this containment mode.

For the env case, it would help to document whether callers should avoid passing host PATH and instead provide a container-safe env block.

Metadata

Metadata

Assignees

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions