{"record":{"id":"6d12bcd784d33a46","repo":"aaif-goose/goose","slug":"goose-binary-not-found-in-any-of-the-possible-path","errorCode":null,"errorMessage":"Goose binary not found in any of the possible paths: ${possiblePaths.join(',')}","messagePattern":"Goose binary not found in any of the possible paths: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"ui/desktop/src/gooseServe.ts","lineNumber":100,"sourceCode":"\n  if (isPackaged && resourcesPath) {\n    possiblePaths.push(path.join(resourcesPath, 'bin', binaryName));\n    possiblePaths.push(path.join(resourcesPath, binaryName));\n  } else {\n    possiblePaths.push(\n      path.join(process.cwd(), 'src', 'bin', binaryName),\n      path.join(process.cwd(), '..', '..', 'target', 'release', binaryName),\n      path.join(process.cwd(), '..', '..', 'target', 'debug', binaryName)\n    );\n  }\n\n  for (const candidate of possiblePaths) {\n    if (existingFile(candidate)) {\n      return candidate;\n    }\n  }\n\n  throw new Error(\n    `Goose binary not found in any of the possible paths: ${possiblePaths.join(', ')}`\n  );\n};\n\nconst findAvailablePort = (): Promise<number> => {\n  return new Promise((resolve, reject) => {\n    const server = createServer();\n\n    server.on('error', reject);\n    server.listen(0, '127.0.0.1', () => {\n      const { port } = server.address() as { port: number };\n      server.close(() => {\n        resolve(port);\n      });\n    });\n  });\n};\n","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/aaif-goose/goose/blob/3810898a7447ec3299be72e223d3570a7aabf0ab/ui/desktop/src/gooseServe.ts#L82-L118","documentation":"Thrown by findGooseBinaryPath as the final fallback: GOOSE_BINARY was not set, and none of the candidate locations held a file — packaged builds check resourcesPath/bin/<name> and resourcesPath/<name>; dev builds check cwd/src/bin/<name>, ../../target/release/<name>, and ../../target/debug/<name> (relative to the Electron process cwd, i.e. ui/desktop). The desktop app cannot start its goose backend without this binary, so this is a hard startup failure.","triggerScenarios":"Development: running the Electron app before any cargo build produced target/debug|release/goose, or with a cwd other than ui/desktop so the ../../target relative candidates miss; Packaged: the build/bundler did not include the goose binary in extraResources, or resourcesPath points elsewhere.","commonSituations":"Fresh clone: 'pnpm dev' without 'cargo build'; release binary built under a different target dir (custom CARGO_TARGET_DIR); packaging config dropping the extraResources entry; running the unpacked asar from an unexpected location.","solutions":["Development: build the binary first (cargo build, or just release-binary for the release path) from the repo root, then run the UI from ui/desktop so '../../target/...' resolves.","Development alternative: export GOOSE_BINARY to an absolute binary path.","Packaged: verify electron-builder extraResources includes the goose binary and that resourcesPath/bin/goose exists inside the app resources.","If CARGO_TARGET_DIR is customized, symlink or copy the binary to one of the searched paths."],"exampleFix":"# before\n# fresh clone, UI only\ncd ui/desktop && pnpm dev   # Error: Goose binary not found in any of the possible paths: ...\n\n# after\n# build the backend the UI can find, then start the UI\ncargo build --release\ncd ui/desktop && pnpm dev","handlingStrategy":"validation","validationCode":"// Pre-flight: verify a binary exists in the searched locations before startup\nimport fs from 'node:fs';\nimport path from 'node:path';\n\nfunction gooseBinaryCandidates(isPackaged: boolean, resourcesPath?: string): string[] {\n  const name = process.platform === 'win32' ? 'goose.exe' : 'goose';\n  return isPackaged && resourcesPath\n    ? [path.join(resourcesPath, 'bin', name), path.join(resourcesPath, name)]\n    : [\n        path.join(process.cwd(), 'src', 'bin', name),\n        path.join(process.cwd(), '..', '..', 'target', 'release', name),\n        path.join(process.cwd(), '..', '..', 'target', 'debug', name),\n      ];\n}\n\nfunction assertGooseBinaryAvailable(isPackaged: boolean, resourcesPath?: string): void {\n  if (!gooseBinaryCandidates(isPackaged, resourcesPath).some((p) => fs.existsSync(p))) {\n    throw new Error('Build goose first: cargo build --release (or set GOOSE_BINARY in dev)');\n  }\n}","typeGuard":"function binaryExistsAt(candidate: string): boolean {\n  try {\n    return fs.statSync(candidate).isFile();\n  } catch {\n    return false;\n  }\n}","tryCatchPattern":"try {\n  const binaryPath = findGooseBinaryPath({ isPackaged: app.isPackaged, resourcesPath: process.resourcesPath });\n} catch (error) {\n  if (/not found in any of the possible paths/.test(String(error))) {\n    showSetupError('Goose backend binary missing — run `cargo build --release` or reinstall the app');\n    return;\n  }\n  throw error;\n}","preventionTips":["On fresh clones, run cargo build (or just release-binary) before 'pnpm dev' in ui/desktop.","Start the Electron dev app with ui/desktop as cwd so '../../target/...' candidates resolve.","For packaging, verify extraResources includes the goose binary under resources/bin."],"tags":["build","packaging","binary","path","startup"],"backgroundTag":null,"analyzedSha":"3810898a7447ec3299be72e223d3570a7aabf0ab","analyzedAt":"2026-08-16T10:14:26.282Z","schemaVersion":2},"datasetVersion":"2026-08-16T13:17:31.715Z"}