{"record":{"id":"81e42e8db887da9f","repo":"musistudio/claude-code-router","slug":"profile-launcher-was-not-found-plan-command-r","errorCode":null,"errorMessage":"Profile launcher was not found: ${plan.command}. Re-save the profile and try again.","messagePattern":"Profile launcher was not found: (.+?)\\. Re-save the profile and try again\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/agents/codex/app-launch.ts","lineNumber":581,"sourceCode":"}\n\nfunction launchCodexCompatibleAppProfile(\n  configDir: string,\n  profile: ProfileConfig,\n  spec: CodexCompatibleAppSpec,\n  config?: AppConfig\n): CodexAppLaunchResult {\n  const lookup = findInstalledCodexCompatibleAppExecutable(spec, profile.appPath);\n  if (!lookup.executable) {\n    throw new Error([\n      `${spec.displayName} was not found. Install ${spec.displayName} or set ${spec.envPathKeys[1]} to its executable, then try again.`,\n      lookup.checked.length ? `Checked: ${lookup.checked.join(\", \")}` : \"\"\n    ].filter(Boolean).join(\" \"));\n  }\n\n  const plan = buildProfileLaunchPlan(configDir, profile, \"app\");\n  if (path.isAbsolute(plan.command) && !existsSync(plan.command)) {\n    throw new Error(`Profile launcher was not found: ${plan.command}. Re-save the profile and try again.`);\n  }\n\n  const configFile = resolveCodexConfigFile(configDir, profile);\n  const codexHome = codexCompatibleHomeFromConfigFile(spec, configFile);\n  const { modelCatalogFile, userDataDir, workbuddyVirtualAuth } = refreshCodexCompatibleAppProfileFiles(configDir, profile, config);\n  if (spec.kind === \"codex\") prepareCodexAppCdpUserDataDir(userDataDir);\n\n  const appEnv: Record<string, string> = {\n    ...plan.env,\n    ...(config ? botGatewayProfileEnv(config, profile, \"app\") : {}),\n    ...codexProfileEnv(profile, lookup.executable, spec),\n    CODEXL_PROFILE_SURFACE: \"app\",\n    CCR_PROFILE_SURFACE: \"app\",\n    ...codexAppAgentEnv(spec, plan.command, codexHome, userDataDir, modelCatalogFile, workbuddyVirtualAuth),\n    ...codexCompatibleAppGatewayEnv(spec, config),\n    ELECTRON_ENABLE_LOGGING: \"1\"\n  };\n  const env: NodeJS.ProcessEnv = {","sourceCodeStart":563,"sourceCodeEnd":599,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/core/src/agents/codex/app-launch.ts#L563-L599","documentation":"Thrown by buildProfileLaunchPlan consumers when the resolved launcher command for a saved Codex-compatible app profile is an absolute path that no longer exists on disk. The profile stores the absolute path of its launcher executable at save time, and this guard verifies it before spawning. If the binary was moved, uninstalled, or the profile was copied from another machine, launch aborts.","triggerScenarios":"Calling launchCodexAppProfile / launchZcodeAppProfile / launchWorkbuddyAppProfile with a profile whose plan.command is absolute and existsSync() fails (deleted/moved executable, stale profile from another machine, missing dependency in a fresh checkout).","commonSituations":"App was updated and the old install path removed; profile saved under a per-version directory (e.g. an electron app in versioned folder); profile JSON migrated between machines or containers; launcher installed via nvm/volta whose node version changed.","solutions":["Re-save the profile from the app so the launcher path is re-resolved to the current install location","Verify the absolute path in the profile exists: ls <plan.command>; if not, locate the new binary and update the profile","Reinstall the application whose launcher the profile points to","If the profile is machine-specific, delete it and create a new one on this machine"],"exampleFix":"// before\nawait launchCodexAppProfile(configDir, profile, config); // throws: launcher not found\n\n// after\nconst plan = buildProfileLaunchPlan(configDir, profile, \"app\");\nif (path.isAbsolute(plan.command) && !existsSync(plan.command)) {\n  await reSaveAppProfile(configDir, profile); // re-resolve launcher path\n}\nawait launchCodexAppProfile(configDir, profile, config);","handlingStrategy":"validation","validationCode":"import { existsSync } from \"node:fs\";\nimport path from \"node:path\";\n\nconst plan = buildProfileLaunchPlan(configDir, profile, \"app\");\nif (path.isAbsolute(plan.command) && !existsSync(plan.command)) {\n  await reSaveProfile(configDir, profile); // or surface a friendly error\n}","typeGuard":"null","tryCatchPattern":"try { await launchCodexAppProfile(configDir, profile, config); } catch (e) { if (/Profile launcher was not found/.test(String(e))) { await reSaveProfile(configDir, profile); } else throw e; }","preventionTips":["Re-save app profiles after reinstalling or upgrading the launcher application","Avoid copying profile configs between machines with absolute launcher paths","Check existsSync(plan.command) before launching in CI or fresh environments"],"tags":["profile","launcher","missing-file","absolute-path"],"backgroundTag":"executable-not-found","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}