aaif-goose/goose · critical

Goose binary not found in any of the possible paths: ${possi

Error message

Goose binary not found in any of the possible paths: ${possiblePaths.join(',')}

What it means

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.

Source

Thrown at ui/desktop/src/gooseServe.ts:100

  if (isPackaged && resourcesPath) {
    possiblePaths.push(path.join(resourcesPath, 'bin', binaryName));
    possiblePaths.push(path.join(resourcesPath, binaryName));
  } else {
    possiblePaths.push(
      path.join(process.cwd(), 'src', 'bin', binaryName),
      path.join(process.cwd(), '..', '..', 'target', 'release', binaryName),
      path.join(process.cwd(), '..', '..', 'target', 'debug', binaryName)
    );
  }

  for (const candidate of possiblePaths) {
    if (existingFile(candidate)) {
      return candidate;
    }
  }

  throw new Error(
    `Goose binary not found in any of the possible paths: ${possiblePaths.join(', ')}`
  );
};

const findAvailablePort = (): Promise<number> => {
  return new Promise((resolve, reject) => {
    const server = createServer();

    server.on('error', reject);
    server.listen(0, '127.0.0.1', () => {
      const { port } = server.address() as { port: number };
      server.close(() => {
        resolve(port);
      });
    });
  });
};

View on GitHub (pinned to 3810898a74)

Solutions

  1. 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.
  2. Development alternative: export GOOSE_BINARY to an absolute binary path.
  3. Packaged: verify electron-builder extraResources includes the goose binary and that resourcesPath/bin/goose exists inside the app resources.
  4. If CARGO_TARGET_DIR is customized, symlink or copy the binary to one of the searched paths.

Example fix

# before
# fresh clone, UI only
cd ui/desktop && pnpm dev   # Error: Goose binary not found in any of the possible paths: ...

# after
# build the backend the UI can find, then start the UI
cargo build --release
cd ui/desktop && pnpm dev
Defensive patterns

Strategy: validation

Validate before calling

// Pre-flight: verify a binary exists in the searched locations before startup
import fs from 'node:fs';
import path from 'node:path';

function gooseBinaryCandidates(isPackaged: boolean, resourcesPath?: string): string[] {
  const name = process.platform === 'win32' ? 'goose.exe' : 'goose';
  return isPackaged && resourcesPath
    ? [path.join(resourcesPath, 'bin', name), path.join(resourcesPath, name)]
    : [
        path.join(process.cwd(), 'src', 'bin', name),
        path.join(process.cwd(), '..', '..', 'target', 'release', name),
        path.join(process.cwd(), '..', '..', 'target', 'debug', name),
      ];
}

function assertGooseBinaryAvailable(isPackaged: boolean, resourcesPath?: string): void {
  if (!gooseBinaryCandidates(isPackaged, resourcesPath).some((p) => fs.existsSync(p))) {
    throw new Error('Build goose first: cargo build --release (or set GOOSE_BINARY in dev)');
  }
}

Type guard

function binaryExistsAt(candidate: string): boolean {
  try {
    return fs.statSync(candidate).isFile();
  } catch {
    return false;
  }
}

Try / catch

try {
  const binaryPath = findGooseBinaryPath({ isPackaged: app.isPackaged, resourcesPath: process.resourcesPath });
} catch (error) {
  if (/not found in any of the possible paths/.test(String(error))) {
    showSetupError('Goose backend binary missing — run `cargo build --release` or reinstall the app');
    return;
  }
  throw error;
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of aaif-goose/goose@3810898a74 (2026-08-16). Data as JSON: /api/errors/6d12bcd784d33a46. Report an issue: GitHub.