Skip to content

Windows: opencode-ai install fails with PE loader error on stub .exe #38169

Closed as not planned

Description

Description

When installing the opencode-ai npm package on Windows, if postinstall fails or is skipped (--ignore-scripts), running opencode produces a Windows PE loader error:

The specified executable is not a valid application for this OS platform

Root Cause

The published package ships �in/opencode.exe as a text-file placeholder stub. npm generates direct-execution .exe wrappers on Windows, so the PE loader tries to run the text file directly. The meaningful error message inside the stub is never displayed because Windows rejects it before Node.js can run it.

Expected Behavior

If the binary is missing or installation is incomplete, the CLI should print a clear, actionable error message instead of a confusing PE loader error.

Steps to Reproduce

  1. Install opencode-ai on Windows with --ignore-scripts
  2. Run opencode
  3. Observe the PE loader error

Suggested Fix

Replace the stub .exe with a Node.js .mjs launcher. npm generates
ode <script> wrappers for .mjs entries, bypassing the PE loader entirely. The launcher can validate binary existence and print clear error messages.

Activity

  1. github-actions commented on Jul 21, 2026

    @github-actions
    Contributor

    This issue might be a duplicate of existing issues. Please check:

  2. github-actions commented on Sep 20, 2026

    @github-actions
    Contributor

    To stay organized issues are automatically closed after 60 days of no activity. If the issue is still relevant please open a new one.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

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