---
title: "Troubleshooting TIR Token Factory"
description: "Fix TIR Token Factory errors from model requests and from the portal, such as invalid api key, model not available, rate limits, and key limits."
content_type: "troubleshooting"
product: "token-factory"
platform: "TIR"
url: "/tir/token-factory/troubleshooting/token-factory/"
relationships: {"troubleshooting-for":["/tir/token-factory/how-to/choose-a-model/","/tir/token-factory/how-to/create-an-api-key/","/tir/token-factory/how-to/block-unblock-or-revoke-an-api-key/","/tir/token-factory/how-to/call-a-model-with-the-openai-sdk/","/tir/token-factory/how-to/call-a-model-with-rest/","/tir/token-factory/how-to/use-tools-json-vision-and-reasoning/","/tir/token-factory/how-to/monitor-usage-and-cost/"]}
---

# Troubleshooting TIR Token Factory

Every reply from a model carries an `X-Request-Id` header. When you contact support about a request,
include that value, the model ID, the time of the request, and the exact error text. For short
answers about keys, models, and billing, see the [TIR Token Factory FAQ](/tir/token-factory/faq/).

## 401: api key required

The request carried no key that Token Factory reads. The key must be in the Authorization header,
written exactly as `Authorization: Bearer <your-api-key>` with a capital B. A key in another header
such as `x-api-key`, a lowercase bearer, a different word such as Token in place of Bearer, or an
empty value after Bearer all give this error. Fix the header and send the request again; sending it
unchanged gives the same error. See [Call a model with
REST](/tir/token-factory/how-to/call-a-model-with-rest/).

## 401: invalid api key

The key is wrong, expired, revoked, or blocked. Check it on **API Keys** in Token Factory:

- If the key is **Expired** or no longer on the list, [create a new
  key](/tir/token-factory/how-to/create-an-api-key/) and use it instead.
- If it is **Blocked** and someone in your project blocked it, unblock it; see [Block, unblock, or revoke an API
  key](/tir/token-factory/how-to/block-unblock-or-revoke-an-api-key/). If its status reads "Blocked
  by Token Factory support", contact [support](/tir/tir-support/) with the key's name, the project's
  name, and the time of the failed request.
- If it is **Active**, check that your code sends the whole key, with nothing added or cut off, and
  that it is a Token Factory API key from this project. A TIR Personal Access Token does not work
  with Token Factory.

## 404: The requested model is not currently available

Token Factory does not serve the model ID in the request, or the request went to a wrong path. Copy
the model ID from the model's page, with its creator part, such as `google/gemma-4-31b-it`, and send
the request to `/chat/completions` under `https://blaze.e2enetworks.net/v1`. If the model was
retired from the catalog, choose another; see [Choose a
model](/tir/token-factory/how-to/choose-a-model/).

## 400: The upstream provider rejected the request

Something in the request itself is wrong, so sending it unchanged gives the same error. Check, in
this order:

- The body is valid JSON and has a `messages` list.
- The prompt fits in the model's context window, shown as **Context** in the model list.
- Every optional field is one the model supports. Remove fields one at a time to find the one it
  refuses.
- Images go only to a model with **Vision**, tools only to a model with **Tools**, and JSON output
  only to a model with **JSON**.

See [Use tools, JSON output, vision, and
reasoning](/tir/token-factory/how-to/use-tools-json-vision-and-reasoning/).

## 429: Upstream rate limit exceeded

The reply's message reads "Upstream rate limit exceeded. Please retry." The model is busy with more
requests than it can take at the moment. Send the request again after a short wait, and make the
wait longer after each failed try. If a model stays busy, choose another model with the capabilities
you need; see [Choose a model](/tir/token-factory/how-to/choose-a-model/).

## 502 or 503: Upstream provider error

The model is unavailable for a moment. Send the request again after a short wait, making the wait
longer after each failed try, or switch to another model; see [Choose a
model](/tir/token-factory/how-to/choose-a-model/).

## 401 or 403: Upstream authentication error

The fault is on E2E's side, not with your key. Contact [support](/tir/tir-support/) with the reply's
`X-Request-Id`, the model ID, the time of the request, and the exact error text.

## A request fails after four minutes

A request that is not streamed fails if the whole reply takes longer than four minutes. Turn
streaming on so the reply arrives as the model writes it; see [Call a model with the OpenAI
SDK](/tir/token-factory/how-to/call-a-model-with-the-openai-sdk/#stream-the-reply).

## A streamed reply stops partway

A stream that stops before a chunk with a finish reason has failed partway, even though the request
started with a success status. Send the request again. To catch this in your code, see [Call a model
with the OpenAI SDK](/tir/token-factory/how-to/call-a-model-with-the-openai-sdk/#stream-the-reply).

## Streaming code fails on the last chunk

The last chunk of a streamed reply carries only the token usage and has no choices, so code that
reads the first choice of every chunk fails on it. Skip chunks without choices; see [Call a model
with the OpenAI SDK](/tir/token-factory/how-to/call-a-model-with-the-openai-sdk/#stream-the-reply).

## The answer is empty and the finish reason is length

The model used all of `max_tokens` before it finished. On a model with **Reasoning**, the reasoning
counts toward `max_tokens` too, and it can use them all before the answer starts. Send the request
again with a higher `max_tokens`; see [Use tools, JSON output, vision, and
reasoning](/tir/token-factory/how-to/use-tools-json-vision-and-reasoning/#read-a-models-reasoning).

## This project already has 25 active API keys

A project can have up to 25 active API keys. Revoke a key you no longer use, then create the new
one; see [Block, unblock, or revoke an API
key](/tir/token-factory/how-to/block-unblock-or-revoke-an-api-key/).

## Add credit to your account to create an API key

On a prepaid account, creating an API key needs a credit balance above zero. Add credit to your
account, then create the key again; see [Billing and Usage](/tir/tir-billing/).

## Could not check your account's credit

TIR shows "Could not check your account's credit. Please try again." when it cannot read your
account's credit while you are creating a key. Try again in a moment; see [Create an API
key](/tir/token-factory/how-to/create-an-api-key/).

## Token Factory is blocked for this project

While Token Factory is blocked for a project, every key in it is refused and no new key can be
created. Contact [support](/tir/tir-support/) with the project's name, the time, and the message
you saw.

## This API key was blocked by Token Factory support

Token Factory support blocked this key, so you cannot block or unblock it from the project. Contact
[support](/tir/tir-support/) with the key's name, the project's name, the time, and the message you
saw.

## Token Factory is unavailable right now

TIR shows "Token Factory is unavailable right now. Please try again in a few minutes." when it
cannot load your API keys or usage figures for a moment. If the message stays after a few
minutes, contact [support](/tir/tir-support/) with the time you saw it and what you were doing, such
as creating a key; see [Create an API key](/tir/token-factory/how-to/create-an-api-key/).

## Token Factory is busy right now

"Token Factory is busy right now. Please try again in a minute." means too many requests to manage
API keys or load usage figures reached Token Factory at once. Wait a minute, then try again; see
[Create an API key](/tir/token-factory/how-to/create-an-api-key/) or [Monitor usage and
cost](/tir/token-factory/how-to/monitor-usage-and-cost/), depending on what you were doing.

## This API key is revoked

The key you acted on has already been revoked, so it can no longer be blocked or unblocked. Refresh
**API Keys**; to restore access, [create a new key](/tir/token-factory/how-to/create-an-api-key/).

## API key not found

The key no longer exists in the project, for example because someone revoked it in another window.
Refresh **API Keys** to see the current list; see [Block, unblock, or revoke an API
key](/tir/token-factory/how-to/block-unblock-or-revoke-an-api-key/).

## Token Factory pricing is not available right now

The model list shows "Token Factory pricing is not available right now. Please try again later."
when it cannot load the prices for your account. Try again later; see [Choose a
model](/tir/token-factory/how-to/choose-a-model/).

## Access Denied! when you open Token Factory

"Your current policies do not permit access to this resource. Please contact your administrator to
request access." means your role or policy does not grant Read access to Token Factory. Ask your
administrator for a role or policy with Read access to Token Factory; see [Manage project members and
policies](/tir/tir-iam/how-to/manage-project-members-and-policies/).
