Skip to content

Bug: 410 Live Search Deprecated — stale @ai-sdk/xai cache causes fallback to deprecated endpoint #256

Description

@alphaonedev

Bug

search_web and search_x tools fail with:

Grok API error: 410 "Live search is deprecated. Please switch to the Agent Tools API:
    https://docs.x.ai/docs/guides/tools/overview"

Root Cause

When a user runs bun add @ai-sdk/xai@latest (which resolves to 3.0.82), Bun's global cache at ~/.bun/install/cache/ stores the 3.0.82 artifact. This version requires zod/v4 subpath exports, which Bun 1.3.x cannot resolve from the global cache. The module resolution fails silently and falls back to a code path that hits the deprecated Live Search API endpoint (/v1/chat/completions with search_parameters) instead of the Responses API (/v1/responses) with Agent Tools.

Even after reverting package.json back to the pinned @ai-sdk/xai@3.0.67, the stale 3.0.82 cache entry persists in ~/.bun/install/cache/@ai-sdk/xai@3.0.82@@@1 and takes precedence.

Reproduction

  1. bun add @ai-sdk/xai@latest (installs 3.0.82)
  2. Revert to @ai-sdk/xai@3.0.67 in package.json
  3. bun install
  4. Run any search — get 410

Fix (user-side workaround)

rm -rf ~/.bun/install/cache/@ai-sdk/xai@3.0.82@@@1
rm -rf ~/.bun/install/cache/@ai-sdk/xai/3.0.82@@@1
rm -rf node_modules && bun install

Suggested Project Fix

  1. Add a note to README/CONTRIBUTING about this Bun cache pitfall
  2. Consider pinning exact versions in bun.lock with a --frozen-lockfile CI check
  3. When Bun resolves the zod/v4 subpath export issue (likely Bun 1.4+), bump to latest SDK

Environment

  • OS: macOS arm64
  • Bun: 1.3.9 – 1.3.11
  • @ai-sdk/xai: 3.0.67 (working) / 3.0.82 (broken via cache)
  • zod: 4.3.6
  • xAI API: Responses API v1

Verified

The pinned v3.0.67 with provider.responses(model) + provider.tools.webSearch() works correctly — confirmed with live test returning fresh results from the Responses API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions