Skip to main content
This page covers the most common problems developers run into when setting up and using @vibesjs/sdk.

Setup issues

Wrong registry: npm:@vibesjs/sdk

If you import from npm:@vibesjs/sdk instead of jsr:@vibesjs/sdk, the import resolves silently but produces no useful exports — the npm name is a placeholder stub. Fix: Always use the JSR registry.
For Node.js, install via the JSR CLI:

Zod version mismatch (v3 vs v4)

Vibes requires Zod v4. Installing zod without a version pin may give you Zod v3, which has a different API. Symptoms include TypeScript errors on z.object, z.string, and similar. Fix:

Missing API key

Every provider requires an API key set as an environment variable. If the key is absent, the provider throws a 401 or similar authentication error at runtime. Fix: Export the key before running your script:
Never commit API keys to source control. Add .env to your .gitignore and use your deployment platform’s secret management in production.

Deno cache corruption

If Deno reports a missing export for a package that exists, a corrupted cache entry may be to blame. This can happen after a failed or partial download. Detect: The import resolves but z (or another export) is undefined at runtime. Fix: Clear the affected entry and re-run:
Replace <package> and <version> with the affected package (e.g. zod/4.0.0).

Provider errors

APICallError / connection refused

This usually means the provider’s API is unreachable or the model name is incorrect. Check:
  1. Your API key is set and valid.
  2. The model string matches the provider’s naming (e.g. "claude-sonnet-4-6" for Anthropic, "gpt-4o" for OpenAI).
  3. You have network access from where the script runs.

Model not found

Passing an unrecognised model ID to a provider function causes the provider to reject the request.

Understanding error classes

@vibesjs/sdk throws typed errors that you can catch and handle specifically. Import them from jsr:@vibesjs/sdk:

Catching a specific error

UsageLimitError fields

When you catch a UsageLimitError, it carries three properties:

Debugging failed tool calls

When a tool call fails, the SDK feeds the error back to the model so it can retry or adjust. If failures persist, add logging inside your execute function:
Set maxRetries on a tool to control how many times the SDK retries a failing execution before propagating the error to the model as a permanent failure.

Common Zod schema mistakes

Using .optional() on required parameters

The model will not pass optional fields reliably. Prefer explicit defaults or separate tools.

Forgetting .describe() on fields

Without descriptions, the model has no guidance on what each field means. Always add .describe() to every parameter.

Overly deep or recursive schemas

Deeply nested or self-referential Zod schemas can cause providers to reject the generated JSON Schema. Keep tool parameters flat where possible.

Next steps

Getting Help

Where to ask questions and report bugs

Installation

Back to the installation guide