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.
Description
Expand-Archivefails 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 callsExpand-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
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
readtool, bypassing theskillloading tool.Expected Behavior
Expand-Archiveshould work when called internally, same as it does from any normal PowerShell session.