Skip to content

Search sometimes fails with “exceeds the available context size” error #1011

@G-Cyrille

Description

@G-Cyrille

Describe the bug
Occasionally, when performing a search, Perplexica stops and returns an error indicating the request exceeds the available context size. The search does not complete and no results are shown for that query.

To Reproduce
Steps to reproduce the behavior:

  1. Start Perplexica with your preferred LLM backend configured.
  2. Use a custom search engine (e.g., searXNG) if you have one set up.
  3. Enter a query that may return many results or involve multiple steps in the search process.
  4. Wait for the search to run.
  5. Observe that sometimes the search fails and shows an error about exceeding context size.

Expected behavior
The search should either:

  • Summarizing results by chunking within the model’s context limit
  • Handle the error : either retry, drop this result or notify the user in the interface

Screenshots

Image
 ⨯ unhandledRejection:  Error: 400 request (355724 tokens) exceeds the available context size (262144 tokens), try increasing it
    at f.generate (.next/server/chunks/607.js:20:19183)
    at cX.makeStatusError (.next/server/chunks/607.js:27:51395)
    at cX.makeRequest (.next/server/chunks/607.js:27:54864)
    at async q.streamText (.next/server/chunks/136.js:1:2480)
    at async i.research (.next/server/chunks/641.js:541:227)
    at async m.searchAsync (.next/server/app/api/chat/route.js:1:13218) {
  status: 400,
  headers: Headers {
    'access-control-allow-origin': '',
    'content-length': '203',
    'content-type': 'application/json; charset=utf-8',
    server: 'llama.cpp',
    date: 'Sat, 28 Feb 2026 08:44:17 GMT'
  },
  requestID: null,
  error: [Object],
  code: 400,
  param: undefined,
  type: 'exceed_context_size_error'
}

Additional context

  • search custom engine searXNG.
  • Embedding : all-MiniLM-L6-v2 and mxbai-embed-large-v1
  • model : unsloth/Qwen3.5-27B-GGUF:UD-Q4_K_XL with 262144 context length

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions