aaif-goose/goose · critical

goose binary package ${pkg} is not installed. Set GOOSE_BINA

Error message

goose binary package ${pkg} is not installed. Set GOOSE_BINARY or install the native package.

What it means

The platform key was found in PLATFORMS, but require.resolve(`${pkg}/package.json`) failed — the optional dependency @aaif/goose-binary-<platform>-<arch> is not installed in node_modules. npm skips failed optionalDependencies silently (common when the platform-specific tarball is missing or was pruned), so the SDK only discovers the absence at resolve time.

Source

Thrown at ui/sdk/src/resolve-binary.ts:39

export function resolveGooseBinary(): string {
  const envBinary = process.env.GOOSE_BINARY;
  if (envBinary) return envBinary;

  const key = `${process.platform}-${process.arch}`;
  const pkg = PLATFORMS[key];
  if (!pkg) {
    throw new Error(
      `No goose binary available for ${key}. Set GOOSE_BINARY to the path of a goose binary.`,
    );
  }

  try {
    const require = createRequire(import.meta.url);
    const pkgDir = dirname(require.resolve(`${pkg}/package.json`));
    const binName = process.platform === "win32" ? "goose.exe" : "goose";
    return join(pkgDir, "bin", binName);
  } catch {
    throw new Error(
      `goose binary package ${pkg} is not installed. Set GOOSE_BINARY or install the native package.`,
    );
  }
}

View on GitHub (pinned to 3810898a74)

Solutions

  1. Set GOOSE_BINARY to an existing binary path — fastest unblock, skips the package resolution entirely
  2. Reinstall with optional deps enabled: rm -rf node_modules package-lock.json && npm install (or verify pnpm/yarn optional config)
  3. Confirm the package exists: npm ls @aaif/goose-binary-<platform>-<arch> and check the registry has the tarball for your platform
  4. For pnpm, ensure optionalDependencies are not filtered in .npmrc

Example fix

# before
npm install --omit=optional
node app.js # throws: goose binary package ... is not installed
# after
export GOOSE_BINARY=/usr/local/bin/goose
node app.js
# or
npm install # with optionals enabled
Defensive patterns

Strategy: fallback

Validate before calling

// At install time (Dockerfile/CI):
// npm ls @aaif/goose-binary-linux-x64 || echo 'set GOOSE_BINARY or fix optionals'
import { existsSync } from 'fs';
if (!process.env.GOOSE_BINARY) {
  // confirm node_modules actually contains the optional package before shipping
}

Type guard

const canResolveNativeBinary = (): boolean => {
  if (process.env.GOOSE_BINARY) return true;
  const pkg = PLATFORMS[`${process.platform}-${process.arch}`];
  if (!pkg) return false;
  try { createRequire(import.meta.url).resolve(`${pkg}/package.json`); return true; }
  catch { return false; }
};

Try / catch

let bin: string;
try {
  bin = resolveGooseBinary();
} catch (e) {
  if (String(e).includes('not installed')) {
    bin = process.env.GOOSE_BINARY!; // caller must guarantee it is set as fallback
  } else throw e;
}

Prevention

When it happens

Trigger: npm/pnpm/yarn install with --no-optional or --omit=optional; npm bug where optional deps are dropped from the lockfile; package-lock generated on one platform then installed on another with the tarball 404; manually pruned node_modules; pnpm hoisting settings hiding the package.

Common situations: CI images caching node_modules across platform changes; Docker multi-arch builds sharing a lockfile; npm ERESOLVE recoveries that silently drop optionals; corporate registries mirroring only some platform tarballs.

Related errors


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