Skip to content

Bug: Expand-Archive module auto-load fails when spawned from opencode.exe (Bun) #24291

Description

@hui6900

Description

Expand-Archive fails with "module could not be loaded" error when called internally by opencode.exe (Bun-compiled v1.14.24) on Windows.
The error occurs in tools like skill, glob (and any internal tool that calls Expand-Archive).

Error Message

Expand-Archive : The 'Expand-Archive' command was found in the module 'Microsoft.PowerShell.Archive',
but the module could not be loaded. For more information, run 'Import-Module Microsoft.PowerShell.Archive'.

Environment

  • OS: Windows (win32)
  • Shell: PowerShell 7.6.1
  • opencode version: 1.14.24
  • Node.js version: 24.15.0
  • Binary: opencode-windows-x64 (Bun v1.3.13)

Investigation

The internal call is:
powershell -NoProfile -NonInteractive -Command
"$global:ProgressPreference = 'SilentlyContinue'; Expand-Archive -LiteralPath ..."
Confirmed working scenarios:

  • pwsh -NoProfile -NonInteractive
  • powershell.exe -NoProfile -NonInteractive
  • Node.js child_process.spawnSync
  • Import-Module Microsoft.PowerShell.Archive -Force
    Module file is intact, PSModulePath is correct, no Zone.Identifier blocking, not an ExecutionPolicy issue.
    Fails only when spawned from opencode.exe (Bun-compiled binary). Likely a Bun child_process environment compatibility issue on Windows.

Workaround

SKILL.md files can be read directly via the read tool, bypassing the skill loading tool.

Expected Behavior

Expand-Archive should work when called internally, same as it does from any normal PowerShell session.

Metadata

Metadata

Assignees

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