BrainAPI
BrainAPI
Operate

For the complete BrainAPI documentation index, see llms.txt. A markdown version of any docs page is available by appending .md to its URL. Docs MCP: /docs/mcp.

Health and troubleshooting

Diagnose BrainAPI startup, authentication, brain, ingestion, storage, Search, plugin, and MCP failures

Start with the failing boundary instead of changing several settings at once. Run brainapi doctor, capture the HTTP status and response body, and verify that API, worker, and MCP processes use the same .env.

Health checklist

brainapi doctor
curl --fail http://localhost:8000/ -H "BrainPAT: $BRAINPAT_TOKEN"
curl --fail http://localhost:8001/
curl --fail http://localhost:9091/healthz
curl --fail http://localhost:9000/minio/health/live

Only test services selected by your deployment profile.

Startup and configuration

SymptomLikely causeDiagnosticFix
API exits with Invalid MODELS_MODERequired mode missing or invalid.Inspect .env loaded by the process.Set MODELS_MODE=local or remote.
API exits with provider validation errorActive provider lacks a model, key, endpoint, or credentials file.Compare provider variables with Configuration.Supply the active provider's complete settings or select another provider.
Console returns 404Static console disabled or not built.Check CONSOLE_ENABLED and console build output.Enable it and build/restart the API, or run the development console.
API and worker disagreeProcesses loaded different environment files.Compare startup logs and service configuration.Mount or copy one .env into all services.

Authentication and brain selection

SymptomLikely causeDiagnosticFix
400 Brain ID is requiredNo brain resolved.Inspect X-Brain-ID, query, or body.Send X-Brain-ID or deliberately enable default fallback.
401 Invalid or missing BrainPATMissing/wrong token or brain-PAT mismatch.Call /meta/login-info with the token.Use the system PAT or the PAT belonging to the selected brain.
406 Brain not foundBrain is absent and creation/fallback is disabled.List/create brains with the system PAT.Create it explicitly or change the intended setting.
503 Database unavailableMongoDB lookup failed.Test Mongo connection and credentials.Correct MONGO_*/connection string and restart.

Ingestion and tasks

SymptomLikely causeDiagnosticFix
Ingest returned 202 but retrieval is emptyWork is still queued/running.Poll /tasks/{task_id} in the same brain.Wait for a terminal success before retrieving.
Task lookup returns 404Wrong task ID/brain or expired cache record.Compare request brain with ingest brain.Use the original brain and task ID; do not treat 404 as pending.
File ingest never advancesParser callback or worker unavailable.Check worker logs and DocParser/OCR configuration.Start the worker and correct parser endpoint/token/callback host.
Structured request returns 422Shape failed Pydantic validation.Check paired event/event_obj, node types, and fields.Correct the payload using structured ingestion.

Search and retrieval

SymptomLikely causeDiagnosticFix
/retrieve/search returns 404Search disabled.Check SEARCH_ENABLED.Use Context or enable Search with PostgreSQL.
Startup rejects SearchWrong data backend or both retrievers disabled.Check DATA_DB, SEARCH_USE_DENSE, and SEARCH_USE_BM25.Use PostgreSQL and enable at least one first stage.
Plugin channel/reranker returns 400Plugin missing, failed, or name wrong.Inspect loader banner and plugin health.Install/restart/fix the plugin and use its registered lowercase name.
Filtered Search returns fewer than kextras is hard-AND filtering after ranking.Remove filters one at a time and inspect facets.Broaden the filters or ingest missing metadata.
Context ranking changed after enabling SearchCONTEXT_PASSAGE_MODE changed its passage leg.Inspect the configured mode.Select ilike, dense, bm25, or hybrid deliberately.

Plugins and MCP

SymptomLikely causeDiagnosticFix
Plugin marked failedManifest, dependency, import, or registration error.Read the loader error before later service logs.Correct that first failure and restart the relevant process.
SPLADE/ColBERT returns no candidates after restartPlugin-local in-memory index is empty.Inspect plugin health/index size.Rebuild the index as part of startup or deployment.
MCP client cannot connectURL, transport, auth, or MCP process mismatch.Curl the MCP health endpoint and inspect client logs.Correct the client URL/transport and OAuth or PAT setup.
Docs MCP finds a hidden pageStale deployment or publication predicate drift.Compare /llms/v2.txt, search, and list_sections.Rebuild/deploy all machine surfaces from the shared predicate.

Ask for help

When reporting an issue, include the BrainAPI version, deployment profile, sanitized configuration choices, exact status/body, task or request ID, and the first relevant error. Never include PATs or provider secrets. Open an issue on GitHub or ask in Discord.

Edit on GitHub

Last updated on

On this page