{"record":{"id":"de82dfcc16de2017","repo":"stablyai/orca","slug":"invalid-orca-electron-vite-target-target-u","errorCode":null,"errorMessage":"Invalid ORCA_ELECTRON_VITE_TARGET: ${target ?? '<unset>'}","messagePattern":"Invalid ORCA_ELECTRON_VITE_TARGET: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"config/electron-vite-target.config.ts","lineNumber":12,"sourceCode":"import { defineConfig } from 'electron-vite'\nimport { electronViteConfig } from '../electron.vite.config'\n\nconst target = process.env.ORCA_ELECTRON_VITE_TARGET\nconst configByTarget = {\n  main: { main: electronViteConfig.main },\n  preload: { preload: electronViteConfig.preload },\n  renderer: { renderer: electronViteConfig.renderer }\n}\n\nif (!target || !Object.hasOwn(configByTarget, target)) {\n  throw new Error(`Invalid ORCA_ELECTRON_VITE_TARGET: ${target ?? '<unset>'}`)\n}\n\nexport default defineConfig(configByTarget[target as keyof typeof configByTarget])\n","sourceCodeStart":1,"sourceCodeEnd":16,"githubUrl":"https://github.com/stablyai/orca/blob/1136503c6a231a16dce8f921f6fadb63d181e8db/config/electron-vite-target.config.ts#L1-L16","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"# before\nnpx electron-vite --config config/electron-vite-target.config.ts build\n# → Invalid ORCA_ELECTRON_VITE_TARGET: <unset>\n\n# after\nORCA_ELECTRON_VITE_TARGET=main npx electron-vite --config config/electron-vite-target.config.ts build","handlingStrategy":"validation","validationCode":"// Validate the env var before importing the config\nconst target = process.env.ORCA_ELECTRON_VITE_TARGET\nconst valid = ['main', 'preload', 'renderer']\nif (!target || !valid.includes(target)) {\n  throw new Error(`Set ORCA_ELECTRON_VITE_TARGET to one of: ${valid.join(', ')} (got: ${target ?? '<unset>'})`)\n}","typeGuard":"function isValidViteTarget(value: string | undefined): value is 'main' | 'preload' | 'renderer' {\n  return value === 'main' || value === 'preload' || value === 'renderer'\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["build-config","vite","electron-vite","environment-variables","config"],"backgroundTag":null,"analyzedSha":"1136503c6a231a16dce8f921f6fadb63d181e8db","analyzedAt":"2026-08-12T23:15:58.167Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}