-
Notifications
You must be signed in to change notification settings - Fork 13.4k
Open
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)
Description
Bug description
The Bun-bundled binary crashes at startup with errors like:
TypeError: undefined is not an object (evaluating 'Snapshot2.FileDiff.array')
TypeError: undefined is not an object (evaluating 'ProviderAuth2.Authorization.optional')
Root cause
Nine facade files (e.g. src/snapshot/index.ts, src/provider/auth.ts) re-export values from a service module inside a TypeScript namespace:
import { Snapshot as S } from "./service"
export namespace Snapshot {
export const FileDiff = S.FileDiff
}Bun's bundler transpiles this into self-referential assignments (Snapshot.FileDiff = Snapshot.FileDiff). When circular imports delay module initialization, the right-hand side is undefined.
Steps to reproduce
- Introduce any circular dependency chain that passes through one of these facade modules
- Build with
bun run build --single - Run the binary — crashes before startup completes
Expected behavior
Binary starts without TypeError.
Environment
- Bun 1.3.10
- opencode built with
--singleflag
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
coreAnything pertaining to core functionality of the application (opencode server stuff)Anything pertaining to core functionality of the application (opencode server stuff)