Skip to content

Troubleshooting

Chang Jia Geng edited this page Mar 2, 2026 · 15 revisions

Current as of 20 Feb 2026

This page describes the common errors encountered and what to do.

No 'usage_metadata'

⁉️ Unexpected message: 'State' object has no attribute 'usage_metadata'

  • Issue: unknown, but happens to new accounts
  • Solution: "Erase memory" and reload the 'app' page

Context length exceeded

⁉️ Unexpected message: Error code: 400 - {'error': {'message': 'Input tokens exceed the configured limit of 272000 tokens. Your messages resulted in 328508 tokens. Please reduce the length of the messages.', 'type': 'invalid_request_error', 'param': 'messages', 'code': 'context_length_exceeded'}}

  • Issue: the previous tool call generated a large amount of text which overloaded the capacity of the LLM.
  • Solution: First, log out and sign-in again. Repeat your query. If it still fails, only then do you click "Erase memory" and reload the 'app' page.

No ToolMessage

⁉️ Unexpected message: Found AIMessages with tool_calls that do not have a corresponding ToolMessage. Here are the first few of those tool calls: [{'name':'...]. Every tool call (LLM requesting to call a tool) in the message history MUST have a corresponding ToolMessage (result of a tool invocation to return to the LLM) - this is required by most LLM providers. For troubleshooting, visit: https://docs.langchain.com/oss/python/langgraph/errors/INVALID_CHAT_HISTORY

  • Issue: previous session was interrupted during a tool call. The model's conversation history is now in an invalid state and must be repaired by deleting the unanswered tool call from the history.
  • Solution: Click "Repair AI" and reload the 'app' page

psycopg.errors

⁉️ Unexpected message: (psycopg.errors.AdminShutdown) terminating connection due to administrator command [SQL: SELECT ...] [parameters: {'table_name': ..., 'schema_name': ...}] (Background on this error at: https://sqlalche.me/e/20/e3q8)

  • No solution. Database was shut-down halfway. Need to contact administrator to restart database service.

Session expired

Session expired. Please log in again. Error 500: Internal Server Error

  • Issue: The token has expired after 2 hours of logging in.
  • Solution: Need to log out and log in to get a new token. If it still doesn't work, the app is down.

Internal Server Error

Error 500: Internal Server Error

  • The app is down. There is no solution but to contact admin.

Rate limit exceeded

  • Issue: Too many requests sent to LLM provider e.g. OpenAI.
  • Solution: Wait a while before trying again.

Budget exceeded

  • Issue: The billing account associated with the LLM API key is out of credits.
  • Solution: Contact admin to recharge credits in dev platform.

Other errors

Initialization error: the connection is closed

  • Issue: app needs to reload. Contact admin ⁉️ Unexpected message: Error code: 400 - {'error': {'message': 'Invalid prompt: your prompt was flagged as potentially violating our usage policy. Please try again with a different prompt: https://platform.openai.com/docs/guides/reasoning#advice-on-prompting', 'type': 'invalid_request_error', 'param': None, 'code': 'invalid_prompt'}}
  • Issue: unknown
  • Solution: Tell the agent to continue and it should be fine

Clone this wiki locally