How to Fix MongoDB Error 390 (InvalidSignature)
You see mongodb error 390 when a digital signature fails a security check. You fix this InvalidSignature error by aligning your signing keys, certificates, or tokens across nodes. Database clusters rely on cryptographic signatures to trust network traffic and user requests. When a signature does not match the expected key, the engine blocks the action right away. This safeguard keeps bad data and fake requests out of your system. What causes mongodb error 390 in your cluster The database eng
Your coding agents run with your access.
Claude Code reaches prod with a developer's credentials, and approval prompts get clicked through. hoop.dev checks every query, masks sensitive data, and holds risky changes for a human.
You see mongodb error 390 when a digital signature fails a security check. You fix this InvalidSignature error by aligning your signing keys, certificates, or tokens across nodes.
Database clusters rely on cryptographic signatures to trust network traffic and user requests. When a signature does not match the expected key, the engine blocks the action right away. This safeguard keeps bad data and fake requests out of your system.
What causes mongodb error 390 in your cluster
The database engine maps code 390 to the official InvalidSignature error name. This failure happens when the server checks a signed payload and finds a mismatch. Several parts of your stack can trigger this exact problem during normal work.
First, internal cluster nodes might hold different key files or certificates after a rotation. One node signs a message with a new key while another checks it with an old key. The receiving node rejects the message and logs code 390.
Second, client apps that log in with signed tokens or certificates can cause this error. If your identity provider rotates its signing key, the database must know about the new key. Until the database refreshes its key list, every login token fails the signature check.
Third, network devices between the client and the database might alter packet bytes in transit. Any change to the payload breaks the math behind the cryptographic signature. The server sees the broken signature and drops the request to protect your data.
How to diagnose and fix InvalidSignature safely
Start your check by reading the server logs to find which request failed. Look at the timestamp and the source address tied to the InvalidSignature event. This tells you if the bad signature came from a peer node or an app.
When engineers inspect the database to check state, give them safe, limited privileges. MongoDB grants access through role-based rules that apply to the database where you define them. A role grants privileges to run sets of actions on defined resources down to a collection level.
Assign the built-in read role so the engineer can inspect non-system collections without changing data. This role allows actions like find, listCollections, listIndexes, dbStats, collStats, and changeStream. It leaves out insert, update, remove, and dropCollection so no one alters data by mistake.
MongoDB Authentication & Authorization + End-to-End Encryption: architecture patterns and best practices
Continue reading? Get the full guide.
Free. No spam. Unsubscribe anytime.
Do not hand out the readWrite role when someone only needs to check signature errors. The readWrite role adds actions like insert, update, remove, createCollection, createIndex, dropIndex, and dropCollection. Note that MongoDB Atlas users have different built-in roles than self-hosted users, though both use the same privilege actions.
Once you find the source of the mismatch, update the stale key or certificate. If a peer node holds an old file, push the current key file and reload the node. If an external token failed, refresh the public signing keys on the database side.
How to prevent signature mismatches during key rotation
Most signature failures happen when teams rush a key or certificate update in production. You can stop these outages by using a phased rollout for every secret change. Never delete the old key before every node trusts the new key.
First, add the new public key or certificate to all nodes in your cluster. Let the cluster accept both the old and new signatures during the change window. Next, switch your signing apps or nodes to use the new private key.
Watch your server logs to make sure no node reports an InvalidSignature error. Once all traffic uses the new key, remove the old key from the trust list. Also, keep system clocks in sync across all servers so time-based signatures stay valid.
Finally, never turn off TLS checks or signature rules just to clear the error fast. Skipping security checks opens your database to man-in-the-middle attacks and spoofed traffic. Fix the root key mismatch and keep your role permissions tight at all times.
Check MongoDB commands and documents on the wire
MongoDB roles and SCRAM login decide who opens a session. They do not check single commands or redact sensitive fields inside returned documents. With hoop.dev, you run an open-source proxy, a sidecar for your MongoDB, inline in the MongoDB wire protocol. On every command an AI agent or engineer runs against production, hoop.dev decides to pass, mask, block, or hold it for human review.
Before a command runs, hoop.dev guardrails check its effect and refuse banned drops or writes with MongoDB error code 13, or hold risky commands for approval. On the way back, hoop.dev data masking rewrites sensitive fields in returned documents in memory, and every verdict is logged. See the open-source code on GitHub.
Frequently asked questions
What does MongoDB Error 390 mean?
Error 390 carries the official name InvalidSignature inside the database engine. It means a cryptographic signature on a token, certificate, or message failed the server check.
Can a key rotation trigger InvalidSignature errors?
Yes, rotating keys without a grace period often causes this exact error across nodes. If a sender uses a new key before the receiver loads it, the signature check fails.
Which MongoDB role should I use to check database state during an outage?
Use the built-in read role on the target database to inspect collections and stats safely. It allows read actions like find and dbStats while blocking write actions like update and dropCollection.
Related guides
In this post