aaif-goose/goose · error

GOOSE_BINARY is only supported in development builds

Error message

GOOSE_BINARY is only supported in development builds

What it means

Thrown by findGooseBinaryPath when the GOOSE_BINARY env var is set but the app reports isPackaged = true (production Electron build). The env override exists only for development builds so devs can point at a locally built goose binary; in packaged builds the binary must come from the bundled resources (resourcesPath/bin), and honoring an env var there would be a security/robustness risk.

Source

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

  startupDiagnosticsPath: string | null;
  getStartupDiagnostics: () => GooseServeStartupDiagnostics | null;
  recordStartupEvent: (name: string, details?: Record<string, unknown>) => void;
}

const existingFile = (candidate: string): boolean => {
  try {
    return fs.existsSync(candidate) && fs.statSync(candidate).isFile();
  } catch {
    return false;
  }
};

export const findGooseBinaryPath = (options: FindGooseBinaryOptions = {}): string => {
  const { isPackaged = false, resourcesPath } = options;
  const pathFromEnv = process.env.GOOSE_BINARY;
  if (pathFromEnv) {
    if (isPackaged) {
      throw new Error('GOOSE_BINARY is only supported in development builds');
    }

    const resolvedPath = path.resolve(pathFromEnv);
    if (existingFile(resolvedPath)) {
      return resolvedPath;
    }
    throw new Error(`Invalid GOOSE_BINARY path: ${pathFromEnv} (pwd is ${process.cwd()})`);
  }

  const binaryName = process.platform === 'win32' ? 'goose.exe' : 'goose';
  const possiblePaths: string[] = [];

  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),

View on GitHub (pinned to 3810898a74)

Solutions

  1. Unset the variable for packaged runs: 'env -u GOOSE_BINARY /Applications/Goose.app/...' (or remove it from the launcher/service environment).
  2. If you actually need a custom binary, run the development build (pnpm dev / electron .) where the override is honored.
  3. For packaged builds, ensure the goose binary is bundled under resourcesPath so the fallback paths resolve.

Example fix

// before
if (pathFromEnv) {
  if (isPackaged) {
    throw new Error('GOOSE_BINARY is only supported in development builds');
  }
...

// after (caller decides policy before invoking)
if (process.env.GOOSE_BINARY && app.isPackaged) {
  console.warn('Ignoring GOOSE_BINARY in packaged build; using bundled binary');
  delete process.env.GOOSE_BINARY;
}
const binaryPath = findGooseBinaryPath({ isPackaged: app.isPackaged, resourcesPath: process.resourcesPath });
Defensive patterns

Strategy: validation

Validate before calling

// Scrub the env var for packaged runs before resolving the binary
function gooseBinaryEnvForMode(isPackaged: boolean): string | undefined {
  if (isPackaged && process.env.GOOSE_BINARY) {
    console.warn('Ignoring GOOSE_BINARY in packaged build');
    return undefined;
  }
  return process.env.GOOSE_BINARY;
}

Try / catch

try {
  const binaryPath = findGooseBinaryPath({ isPackaged: app.isPackaged, resourcesPath: process.resourcesPath });
} catch (error) {
  if (/only supported in development builds/.test(String(error))) {
    delete process.env.GOOSE_BINARY;
    return findGooseBinaryPath({ isPackaged: app.isPackaged, resourcesPath: process.resourcesPath });
  }
  throw error;
}

Prevention

When it happens

Trigger: Launching an installed (packaged) goose desktop app from a shell or launcher environment that still exports GOOSE_BINARY; CI smoke tests that set GOOSE_BINARY globally then run a packaged build; a .env loader injecting the var into production.

Common situations: Developers packaging locally ('just build' / electron-builder) and running the artifact from the same terminal used for dev; CI environments with GOOSE_BINARY in the base image.

Related errors


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