{"record":{"id":"11403c517afa33bf","repo":"jackwener/OpenCLI","slug":"could-not-launch-label-no-compatible-executabl","errorCode":null,"errorMessage":"Could not launch ${label}: no compatible executable found in ${path.join(appPath, 'Contents', 'MacOS')}","messagePattern":"Could not launch (.+?): no compatible executable found in (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"src/launcher.ts","lineNumber":317,"sourceCode":"  const executables = resolveExecutableCandidates(appPath, app);\n  let lastMissingExecutableError: CommandExecutionError | undefined;\n\n  for (const executable of executables) {\n    log.debug(`[launcher] Launching: ${executable} ${args.join(' ')}`);\n    try {\n      await launchDetachedApp(executable, args, label);\n      return;\n    } catch (err) {\n      if (isMissingExecutableError(err, label)) {\n        lastMissingExecutableError = err as CommandExecutionError;\n        continue;\n      }\n      throw err;\n    }\n  }\n\n  if (executables.length > 1) {\n    throw new CommandExecutionError(\n      `Could not launch ${label}: no compatible executable found in ${path.join(appPath, 'Contents', 'MacOS')}`,\n      `Tried: ${executables.map((executable) => path.basename(executable)).join(', ')}. Install ${label}, reinstall it, or register a custom app path in ~/.opencli/apps.yaml`,\n    );\n  }\n\n  throw lastMissingExecutableError ?? new CommandExecutionError(\n    `Could not launch ${label}`,\n    `Install ${label}, reinstall it, or register a custom app path in ~/.opencli/apps.yaml`,\n  );\n}\n\nexport function electronLaunchArgs(port: number, extraArgs: string[] = []): string[] {\n  return [\n    `--remote-debugging-port=${port}`,\n    '--remote-allow-origins=*',\n    ...extraArgs,\n  ];\n}","sourceCodeStart":299,"sourceCodeEnd":335,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/src/launcher.ts#L299-L335","documentation":"launchElectronApp scans <appPath>/Contents/MacOS for candidate executables and tried each one; when more than one candidate exists but every attempt failed (executables.length > 1 with a stored lastMissingExecutableError path) it throws this CommandExecutionError listing what it tried. It means the Electron app bundle could not be launched from the resolved path.","triggerScenarios":"On macOS, resolveElectronEndpoint -> launchElectronApp with an appPath whose Contents/MacOS contains multiple files/executables (or multiple stale binaries) and none could be launched successfully.","commonSituations":"Corrupted or partial Electron install; custom app path in ~/.opencli/apps.yaml pointing at a bundle with helper binaries alongside the main one; app updated/renamed so old binaries remain; wrong architecture binary (x64 app on arm64).","solutions":["Reinstall the app so the bundle contains one working main executable.","Set a custom app path in ~/.opencli/apps.yaml pointing to the correct .app bundle.","Check the 'Tried:' list in the error and remove stale/duplicate binaries from Contents/MacOS, keeping only the main executable.","Verify the binary matches your CPU architecture (arm64 vs x64)."],"exampleFix":"// before (~/.opencli/apps.yaml)\nmyapp: /Users/me/Downloads/MyApp-old.app\n// after\nmyapp: /Applications/MyApp.app","handlingStrategy":"try-catch","validationCode":"import fs from \"fs\";\nconst macosDir = path.join(appPath, \"Contents\", \"MacOS\");\nif (!fs.existsSync(macosDir)) throw new Error(`Not a macOS app bundle: ${appPath}`);\nconst execs = fs.readdirSync(macosDir);\nif (execs.length === 0) throw new Error(`No executables in ${macosDir}`);","typeGuard":"function isValidAppBundle(appPath: string): boolean {\n  return fs.existsSync(path.join(appPath, \"Contents\", \"MacOS\"));\n}","tryCatchPattern":"try {\n  launchElectronApp(appPath);\n} catch (e) {\n  if (e instanceof CommandExecutionError && /no compatible executable/.test(e.message)) {\n    console.error(`${e.message}\\n${e.hint ?? \"\"} — reinstall the app or fix apps.yaml path`);\n  }\n}","preventionTips":["Point apps.yaml at the top-level .app bundle, not an inner binary.","Reinstall apps whose bundles contain multiple stale executables.","Verify architecture compatibility (arm64 vs x64) before launching.","Keep Contents/MacOS clean of leftover helper binaries."],"tags":["macos","electron","launch-failure"],"backgroundTag":"executable-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}