stablyai/orca · error
Invalid ORCA_ELECTRON_VITE_TARGET: ${target ?? '<unset>'}
Error message
Invalid ORCA_ELECTRON_VITE_TARGET: ${target ?? '<unset>'} What it means
This config file (electron-vite-target.config.ts) selects a subset of the full electron-vite config (main, preload, or renderer) based on the ORCA_ELECTRON_VITE_TARGET environment variable. If the env var is unset or not one of the three valid keys ('main', 'preload', 'renderer'), the module throws at import time. This config is used by the parallel build runner (run-electron-vite-targets-in-parallel.mjs) which sets the env var for each subprocess.
Source
Thrown at config/electron-vite-target.config.ts:12
import { defineConfig } from 'electron-vite'
import { electronViteConfig } from '../electron.vite.config'
const target = process.env.ORCA_ELECTRON_VITE_TARGET
const configByTarget = {
main: { main: electronViteConfig.main },
preload: { preload: electronViteConfig.preload },
renderer: { renderer: electronViteConfig.renderer }
}
if (!target || !Object.hasOwn(configByTarget, target)) {
throw new Error(`Invalid ORCA_ELECTRON_VITE_TARGET: ${target ?? '<unset>'}`)
}
export default defineConfig(configByTarget[target as keyof typeof configByTarget])
View on GitHub (pinned to 1136503c6a)
Solutions
- Set ORCA_ELECTRON_VITE_TARGET to 'main', 'preload', or 'renderer' before running the build.
- If building all three targets, use the parallel runner: `node config/scripts/run-electron-vite-targets-in-parallel.mjs` which sets the env var for each subprocess.
- If you added a new build target, add it to configByTarget at line 5 and ensure the parallel runner iterates over it.
Example fix
# before npx electron-vite --config config/electron-vite-target.config.ts build # → Invalid ORCA_ELECTRON_VITE_TARGET: <unset> # after ORCA_ELECTRON_VITE_TARGET=main npx electron-vite --config config/electron-vite-target.config.ts build
Defensive patterns
Strategy: validation
Validate before calling
// Validate the env var before importing the config
const target = process.env.ORCA_ELECTRON_VITE_TARGET
const valid = ['main', 'preload', 'renderer']
if (!target || !valid.includes(target)) {
throw new Error(`Set ORCA_ELECTRON_VITE_TARGET to one of: ${valid.join(', ')} (got: ${target ?? '<unset>'})`)
} Type guard
function isValidViteTarget(value: string | undefined): value is 'main' | 'preload' | 'renderer' {
return value === 'main' || value === 'preload' || value === 'renderer'
} Prevention
- Use the parallel runner script (run-electron-vite-targets-in-parallel.mjs) which sets the env var correctly for each subprocess.
- Don't import electron-vite-target.config.ts directly without setting ORCA_ELECTRON_VITE_TARGET.
- Add the valid values to a shared constant if multiple scripts reference them.
When it happens
Trigger: Running `electron-vite build` with this config without setting ORCA_ELECTRON_VITE_TARGET. Setting it to a typo or invalid value like 'main-process' instead of 'main'. The parallel runner (run-electron-vite-targets-in-parallel.mjs:17) failing to pass the env var to a subprocess.
Common situations: Running the per-target build config directly instead of through the parallel runner. Typo in the env var name or value. A new build target added without updating configByTarget. Importing this config file from a tool that doesn't set the env var.
Related errors
- [plain-node-entry-guard] guarded ${missing.map((name) => `"$
- [plain-node-entry-guard] "${entryName}" reaches chunk "${chu
- [plain-node-entry-guard] could not smoke-load daemon-entry.j
- [plain-node-entry-guard] daemon-entry.js did not exit within
- [plain-node-entry-guard] daemon-entry.js was killed by ${res
AI-assisted analysis of stablyai/orca@1136503c6a (2026-08-12).
Data as JSON: /api/errors/de82dfcc16de2017.
Report an issue: GitHub.