vercel/ai · error

ACP Gateway profile values are unavailable.

Error message

ACP Gateway profile values are unavailable.

What it means

requireGateway ensures the resolved ACP configuration contains a gateway profile (ACPGatewayValues) before the bridge reads its fields. When the resolved profile has no gateway values (gateway == null), the library throws because downstream code cannot build protocol configuration without them.

Source

Thrown at packages/harness-acp/src/v1/bridge/protocol-configuration.ts:136

}): Readonly<Record<string, unknown>> {
  const result: Record<string, unknown> = { ...left };
  for (const [key, value] of Object.entries(right)) {
    const previous = result[key];
    result[key] =
      isRecord(previous) && isRecord(value)
        ? mergeRecords({ left: previous, right: value })
        : value;
  }
  return result;
}

function requireGateway({
  gateway,
}: {
  gateway: ACPGatewayValues | undefined;
}): ACPGatewayValues {
  if (gateway == null) {
    throw new Error('ACP Gateway profile values are unavailable.');
  }
  return gateway;
}

function asRecord(value: unknown): Readonly<Record<string, unknown>> {
  if (!isRecord(value)) {
    throw new Error('ACP profile data must resolve to an object.');
  }
  return value;
}

function isRecord(value: unknown): value is Readonly<Record<string, unknown>> {
  return value != null && typeof value === 'object' && !Array.isArray(value);
}

View on GitHub (pinned to 69428b1f8b)

Solutions

  1. Add/repair the gateway values in the ACP profile being resolved so gateway is defined.
  2. Check that the correct profile is being resolved (profile id/name typo).
  3. Verify the profile resolution step (e.g. loading from config/env) actually populates gateway values.
  4. Guard the call site: only invoke resolved/requireGateway after confirming the profile has gateway data.

Example fix

// before
const cfg = resolved({ profile: profiles['dev'] }); // profile has no gateway
// after
const profile = profiles['dev'];
if (!profile?.gateway) throw new Error('Profile dev is missing gateway values');
const cfg = resolved({ profile });
Defensive patterns

Strategy: validation

Validate before calling

if (profile?.gateway == null) {
  throw new Error(`Profile '${profile?.id ?? 'unknown'}' has no gateway values`);
}

Type guard

function hasGateway(profile: unknown): profile is { gateway: ACPGatewayValues } {
  return profile != null && typeof profile === 'object' && !Array.isArray(profile) &&
    (profile as any).gateway != null;
}

Prevention

When it happens

Trigger: Calling requireGateway (via resolved) on a profile whose resolution yielded an undefined gateway — e.g. an ACP implementation/profile configured without gateway values, or a lookup that failed to populate gateway settings.

Common situations: A profile defined in config without the gateway section; a profile name typo causing resolution of an incomplete record; environment-specific config where gateway values are provisioned differently and missing locally.

Related errors


AI-assisted analysis of vercel/ai@69428b1f8b (2026-08-30). Data as JSON: /api/errors/cd3c7f117b225186. Report an issue: GitHub.