Skip to content

Troubleshooting Guide

Diagnose and resolve common errors with spec loading, stdio streams, and API calls.

This guide lists common error scenarios, their causes, and the concrete steps to resolve them.


1. “No tools were generated” (Exit code 2)

Symptom

The runner crashes on startup with the stderr message:

[apibear] error: no tools were generated from specification

Cause

  • Your OpenAPI specification has no operations matching supported HTTP methods (GET, POST, PUT, PATCH, DELETE).
  • You passed --only with operation IDs that do not exist in the specification.
  • All operations were marked as deprecated: true and includeDeprecated was not enabled.

Fix

  1. Run with --list-tools without the --only flag to see all parsed tools:
    npx -y apibear --spec ./openapi.json --list-tools
  2. Verify that the operation IDs in your --only comma-separated list match the exact casing of the IDs printed by --list-tools.

2. Corrupted MCP Session / Client Disconnects Immediately

Symptom

Claude Desktop or Cursor displays a red disconnected dot or reports:

Unexpected token '<' in JSON at position 0

Cause

A process or shell script wrote non-JSON-RPC text to stdout. Common triggers include:

  • A wrapper script echoing status text to stdout.
  • console.log() statements added during local development.
  • Shell profile scripts (.bashrc / .zshrc) printing banners or messages upon subshell execution.

Fix

  • Ensure that only apibear runs directly.
  • Verify that your wrapper or launch command redirects any auxiliary output to stderr:
    my-script.sh >&2

3. Tool call returns “unknown argument: <name>”

Symptom

When your assistant invokes a tool, the call fails immediately with:

unknown argument: page_size

Cause

The AI assistant passed a property that was not defined in the OpenAPI parameter list or request body schema. API Bear enforces strict pre-flight validation to prevent invalid HTTP queries from reaching your upstream API.

Fix

  • Check the OpenAPI specification for that operation. Confirm that parameter names and query arguments match the spec definition.
  • If the argument is optional in your API, ensure it is documented in the OpenAPI document so API Bear includes it in the tool’s inputSchema.

4. “unsupported content type: multipart/form-data”

Symptom

A tool call errors with:

unsupported content type: multipart/form-data

Cause

The endpoint expects binary file uploads or multipart payloads. In v1, API Bear supports application/json and application/x-www-form-urlencoded. Binary/multipart formats are not supported in stdio tool execution.

Fix

  • Use --only to exclude file-upload endpoints from the MCP server.
  • Implement file uploads using direct presigned S3/GCS upload URLs or specialized binary tools.

5. Tool call times out / missing --base-url

Symptom

  • Tool calls hang for 30 seconds and return a timeout error.
  • Tool calls fail immediately stating:
    No server URL defined in spec. Provide --base-url <url>.

Cause

  • The target API is slow or unreachable from your current network/VPN.
  • The OpenAPI document uses relative server paths (/api/v1) without a root domain.

Fix

  • Supply an explicit, reachable base URL using --base-url:
    --base-url "https://api.yourcompany.internal"
  • Increase the timeout threshold if endpoints perform heavy computational work:
    --timeout 60000