> For the complete documentation index, see [llms.txt](https://docs.tensorx.ai/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.tensorx.ai/support/troubleshooting.md).

# Troubleshooting

Common issues and solutions when using TensorX with AI coding tools.

***

## API Error: Cannot read properties of undefined

### Cause

Usually happens when environment variables are conflicting or the base URL is incorrect.

### Solution

1. **Verify your API base URL**:
   * For Claude Code: `https://api.tensorx.ai`
   * For Cursor/Cline: `https://api.tensorx.ai/v1`
2. **Replace the placeholder** `YOUR_API_KEY` with your actual TensorX API key
3. **Clear conflicting environment variables**:

```bash
# For Claude Code
unset ANTHROPIC_AUTH_TOKEN ANTHROPIC_BASE_URL

# For Cursor/Cline
unset OPENAI_API_KEY OPENAI_BASE_URL
```

4. **Check your API credits** at [app.tensorx.ai/dashboard](https://app.tensorx.ai/dashboard)

***

## Claude Code: Model Errors or Background Task Failures

### Cause

Claude Code requires **all 5 model environment variables** to be set, even if you only use one model. Missing variables cause background task failures.

### Solution

Set all required model variables:

```bash
export ANTHROPIC_MODEL="z-ai/glm-5.1"
export ANTHROPIC_SMALL_FAST_MODEL="z-ai/glm-5.1"
export ANTHROPIC_DEFAULT_HAIKU_MODEL="z-ai/glm-5.1"
export ANTHROPIC_DEFAULT_SONNET_MODEL="z-ai/glm-5.1"
export ANTHROPIC_DEFAULT_OPUS_MODEL="z-ai/glm-5.1"
```

{% hint style="warning" %}
**All 5 variables are required.** Claude Code uses different model variables for different internal tasks. If any are missing, you'll see errors.
{% endhint %}

***

## Connection Timeout

### Cause

The default timeout may be too short for complex operations.

### Solution

Increase the timeout value in your configuration:

```bash
export API_TIMEOUT_MS="3000000"
```

***

## Model Not Found

### Cause

Using incorrect model ID format.

### Solution

Always use the full model ID with provider prefix:

| ✅ Correct              | ❌ Incorrect  |
| ---------------------- | ------------ |
| `z-ai/glm-5.1`         | `glm-5.1`    |
| `minimax/minimax-m2`   | `minimax-m2` |
| `minimax/minimax-m2.5` | `m2.5`       |

Browse all available models at [tensorx.ai/models](https://tensorx.ai/models).

***

## Authentication Failed

### Cause

Invalid or expired API key.

### Solution

1. Log in to [app.tensorx.ai](https://app.tensorx.ai)
2. Navigate to your [dashboard](https://app.tensorx.ai/dashboard)
3. Generate a new API key
4. Update your configuration with the new key

***

## OAuth Conflict (Claude Code)

### Cause

Claude Code's built-in OAuth login conflicts with TensorX configuration.

### Solution

If you accidentally trigger OAuth:

1. Press `Ctrl+C` to cancel the OAuth prompt
2. Verify your environment variables are set correctly
3. Restart Claude Code

{% hint style="info" %}
**Print mode (`-p`)** works without any Anthropic account or OAuth - it's the fastest way to test your setup.
{% endhint %}

***

## Rate Limiting

### Cause

Too many requests in a short period, or too many tokens reserved in a single request.

### Diagnosing RPM vs TPM Limits

Check the `Limit type` field in the 429 error message to determine which limit you hit:

| Error message          | You hit | Meaning                             |
| ---------------------- | ------- | ----------------------------------- |
| `Limit type: requests` | RPM     | Too many API calls per minute       |
| `Limit type: tokens`   | TPM     | Too many tokens reserved per minute |

### Solution

* **If you hit RPM:** Wait a few seconds between requests, or batch similar calls together
* **If you hit TPM:** Your `max_tokens` value may be too high — each request reserves its full `max_tokens` against your TPM allowance while in flight

{% hint style="warning" %}
Some editors and IDEs (e.g. Zed) default `max_tokens` to the full context window size (1,048,576). This means each request reserves \~1M tokens, even if the actual output is only a few thousand. If you're hitting TPM limits after just a few requests, reduce `max_tokens` to a realistic value (e.g. 8192).
{% endhint %}

* Check your usage at [app.tensorx.ai/dashboard](https://app.tensorx.ai/dashboard)
* See [Rate Limits](https://docs.tensorx.ai/api-reference/rate-limits) for tier details and how to request higher limits
* Contact <support@tensorx.ai> if you need higher limits

***

## Need More Help?

* 📧 **Email**: <support@tensorx.ai>
* 📚 **Documentation**: [docs.tensorx.ai](https://docs.tensorx.ai)
* 💬 **Contact Support**: [Contact page](/support/support.md)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter, and the optional `goal` query parameter:

```
GET https://docs.tensorx.ai/support/troubleshooting.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
