Troubleshoot the local server
This guide covers failures that appear in an MCP client connected to agrag-mcp. The client starts a graph owner in the background, and the owner holds the graph for one project folder. For how sessions attach to the owner, how waiting jobs work, and what each owner state allows, see Run the MCP server. For errors from the Python API and the storage backends, see Troubleshoot common errors.
Wait for the embedding model download
The first start for a graph downloads the default embedding model, ibm-granite/granite-embedding-small-english-r2. The pinned files total about 100 MB. The owner reports ready before the download finishes, so the client can list tools at once. Embedding operations fail until the download is verified.
You see:
the embedding model is still preparing; retry when it is ready
Lexical searches, document listings and job reads still work during the download. Schema additions and document adds run as waiting jobs and start when the model is ready.
- Wait for the download to finish, then retry the operation. The download runs once for each model revision, and later starts use the cached copy.
- If the download keeps failing, check the network access to Hugging Face and the disk space in the model cache. The cache folder is set by
EMBEDDING_CACHE_FOLDER. When it is unset, the cache is$XDG_CACHE_HOME/agrag/models, or~/.cache/agrag/modelswhenXDG_CACHE_HOMEis unset.
The owner writes the download into a staging folder. It checks the size and SHA-256 digest of each file before it publishes the snapshot. A partial download never appears as a usable model.
After three failed attempts, the owner reports the failure in place of the wait message:
embedding model preparation failed: onnx-community/granite-embedding-small-english-r2-ONNX at 1dc7835ba0cb9c76a3618d0bf0c427c97671b3c8 failed after 3 attempts: <cause>
Restore the network access or free the disk space, then start a new owner. The failure does not stop later attempts. A new owner tries the download again. To start one, wait for the current owner to exit after MCP_OWNER_IDLE_SECONDS, which defaults to 300, or stop it as described in the next section.
Recover after the owner process dies
The proxy that each client session starts checks the owner through its health endpoint. The checks run in two places.
- While a tool call runs, the proxy checks the owner every 2 seconds. Two failed checks in a row cancel the call. The client receives an error that starts with
result unknown. The full text isresult unknown: the graph owner stopped during this call, so it may or may not have run. Check the state before retrying the change. - Between calls, the proxy pings the owner every 15 seconds. A failed ping ends the session, and the next request attaches again.
The operating system releases the owner's lock when its process exits. A dead owner therefore leaves no lock behind that blocks a new one.
- Check the state of the change before you retry it after a
result unknownerror. Useget_jobfor a job, or read the document, to see whether the change landed. - Retry the request. When no owner answers and the owner lock is free, the proxy removes the stale discovery record and starts a new owner for the same graph folder.
- If the retry fails, find the message in this table.
| You see | Cause | Fix |
|---|---|---|
a graph owner still holds the graph and does not accept the bearer in <path>; stop that owner process, then retry | A process holds the owner lock but does not answer the discovery record. | Read the pid field in the discovery file named in the message. Stop that process, then retry. |
the graph owner did not finish restarting; retry | An older owner was asked to drain, and it did not release the graph within 20 seconds. | Retry after the old owner exits. |
the graph owner did not start; see <path> | The new owner exited or did not print its ready line within 60 seconds. | Read the owner log at the named path. |
the graph owner speaks another protocol version | The owner that the proxy started reports a different protocol version. | Make the client and the owner run the same agentic-graphrag version. |
this agrag-mcp is older than the running owner (<version>). ... | The running owner is newer than this proxy. | Upgrade the agentic-graphrag install that the client runs, or stop the process named in the discovery file. |
The discovery file and the owner log are in the owner folder. The folder name is the first 32 hexadecimal characters of the SHA-256 digest of the canonical graph folder path. On Linux and macOS, the owner folder is $XDG_RUNTIME_DIR/agrag-<uid>/<key> when XDG_RUNTIME_DIR is set, and <system temporary directory>/agrag-<uid>/<key> otherwise. Each owner appends its output to owner.log in that folder, and the folder is private to your user.
Wait out a lease left by a killed writer
A killed writer can leave a lease that still looks live. The lease expires on its own, and the next writer that needs it takes it over after expiry. Two kinds of lease apply.
Graph write lease
A write job takes one lease for the whole graph. The job renews it every 15 seconds, and the lease expires 60 seconds after its last renewal. A new write job that starts while the lease is live fails with:
a graph write job is already running
The 60-second value is set in the server code and has no environment setting. When the owner starts, it marks any job whose lease has expired as interrupted. Check the job with get_job, then run the write again if it did not finish. A write that reached the database before the kill can still be there, so check the graph before you repeat it.
- Wait up to 60 seconds after the writer stopped.
- Retry the write. A new job takes over an expired lease.
Document lease
The Cutover Job takes a lease on each document it changes. The lease length comes from CUTOVER_JOB_LEASE_TTL_SECONDS, which defaults to 60. A second job for the same document fails with:
Another live job holds the lease for document '<key>'.
If the killed job ran on the same host, the next writer for the document finds that the holder process has exited and releases the lease at once. Run the call again. A lease held by a process on another host, or written by agentic-graphrag 0.0.9, has no holder this host can check. Wait for the TTL to pass after the killed job stopped, then run the call again.
Lower CUTOVER_JOB_LEASE_TTL_SECONDS only if a crashed job blocks a document for too long. A live worker that stalls longer than the TTL loses its lease, and the job then fails with Job <id> lost its lease during renewal.
Fix a no-schema refusal
add_document and add_file publish the default schema when the graph has none. Other writes and schema-dependent reads need a stored schema. The server refuses these calls until the schema exists, and the refusal names the tool that fixes it.
| You see | Cause | Fix |
|---|---|---|
the graph has no schema yet; call apply_schema_additions first | update_document, repair_vectors, list_pending_work or submit_work_results runs before any schema is stored. | Call apply_schema_additions with a shipped preset name or an inline schema object, or add a document to publish the default schema. Then check the job with get_job. |
the graph has no schema to replace; call apply_schema_additions first | A destructive tool runs on a graph that has no stored schema. | Call apply_schema_additions first. Use replace_schema only to change a schema that already exists. |
The graph has no stored schema. Open it with Graph.open, or use a schema tool to set one before reading. | A schema-dependent read runs before any schema is stored. | Call apply_schema_additions first. |
the server scope must be '*' to change the schema | The server starts with a scope other than *. | Start the server with scope * to add or replace a schema. |
the server is read-only | The server runs in read-only mode. | Start the server with write access. |
Schema change refused; pass replace_schema=True: <changes> | apply_schema_additions adds types only. The new schema removes or tightens a stored type or property. The job fails with this message. | Call replace_schema with the new schema. It returns a preview that lists the removals and tightening, and the client confirms it before the job runs. |
apply_schema_additions does not accept replace_schema. Any change that removes or tightens the stored schema must go through replace_schema.
A schema job that fails shows its error in get_job. The error text is cut at 500 characters, so read the full message from the owner log if a long change list is cut off.
After a schema change, run get_job on the job until it reports done, then retry the call that was refused.