When a request results in aDocumentation Index
Fetch the complete documentation index at: https://theseventeen-2abbdf80.mintlify.app/llms.txt
Use this file to discover all available pages before exploring further.
"denied" or "error" status, the reason field carries a machine-readable code that tells you exactly what went wrong. Your client should handle each code explicitly rather than treating all non-success responses the same way.
unregistered_binary_pending_approval
unregistered_binary_pending_approval
Status:
deniedWhat causes it: Your binary’s SHA-256 hash was not found in the daemon’s approved config.json database, or the hash was found but the binary path did not match. This happens the first time you run a new or updated binary without registering it first.What the daemon does: It writes details about the connection attempt (binary path, hash, command-line arguments, timestamp) to ~/.config/keychain-auth/pending.json for manual review, sends this denial response, and immediately closes the socket connection. No further requests can be sent on this connection.What your client should do:- Detect that the connection has been closed after receiving this response.
-
Surface a clear, actionable error message to your user, for example:
- Do not retry automatically. The binary cannot proceed until a human explicitly approves it.
keychain-auth register $(which your-tool) to your installation script so users are registered before they ever hit this error.service_not_allowed
service_not_allowed
Status:
deniedWhat causes it: Your binary attempted to read from or write to a service namespace that is not listed in its policy. For read and search operations, the service must be in allowed_read_services. For write and delete operations, the service must be in allowed_write_services.What your client should do:- Do not retry the same request — it will be denied again.
-
Surface an error that names the service and the action, for example:
-
If you are the tool author, check that your registration includes the correct
allowed_read_servicesandallowed_write_servicesentries.
action_not_in_policy
action_not_in_policy
Status:
deniedWhat causes it: Your binary attempted a search action, or a read or delete with "match": "prefix", but its policy does not have can_search: true. Prefix-based read and delete require search capability because the daemon must enumerate keys internally to resolve matches.What your client should do:- Do not retry without a policy change.
- If search is genuinely needed for your use case, ask the user or administrator to enable
can_search: truefor your binary inconfig.json. - If your code sent
"match": "prefix"unintentionally, switch to"match": "exact"and provide full key names.
malformed_request
malformed_request
Status:
errorWhat causes it: The daemon could not parse or validate your request. Common causes:- Invalid JSON syntax (missing bracket, trailing comma, etc.)
typeis not"REQUEST"actionis not one of"read","write","delete","search"matchis set to an unrecognized valueactionis"write"andtargets.lengthdoes not equalvalues.lengthactionis"write"andmatchis"prefix"targetsis empty when required (all actions exceptsearchin exact mode require at least one target)
- Treat this as a programming error in your client code — log the full request payload for debugging.
- Do not retry the same request unchanged.
- Validate
targetsandvalueslengths before sending write requests. - Verify that your JSON serializer is writing valid newline-terminated JSON.
The connection remains open after a
malformed_request error. You can send corrected requests on the same connection.internal_error
internal_error
Status:
errorWhat causes it: The daemon successfully authorized your request but encountered a failure when communicating with the underlying OS keychain backend. Common causes:- macOS Keychain database is locked (user has logged out or the keychain has been explicitly locked).
- Linux D-Bus session is unavailable or the GNOME Keyring / KWallet daemon is not running.
- Windows Credential Manager returned an unexpected error.
- Headless environments where no keychain backend is available and the fallback file-based store is inaccessible.
- This error may be transient. It is reasonable to retry once after a short delay (1–2 seconds).
-
If the error persists, surface a message that the keychain backend is unavailable and suggest the user check their keychain status:
- The connection remains open. You may retry on the same connection or reconnect.
target_not_allowed
target_not_allowed
Status:
deniedWhat causes it: Your binary requested a specific target key that its policy does not permit. This is a more granular variant of service_not_allowed — the service namespace may be allowed, but the specific key name is restricted.What your client should do:- Do not retry the same request.
- Check whether the target key name is correct and within the service namespace your binary is authorized for.
- If the key is legitimate, verify the policy configuration in
~/.config/keychain-auth/config.json.
hash_mismatch_during_fork
hash_mismatch_during_fork
Status:
deniedWhat causes it: The daemon detected that the binary making the request has a different hash than the binary that originally established the connection. This can occur if a binary replaces itself in memory or if an unexpected process substitution occurred.What your client should do:- This is a security event — do not retry.
- Surface an alert to the user that the daemon detected an unexpected hash change mid-connection.
- If the binary was legitimately updated, run
keychain-auth upgrade $(which your-tool)to refresh the approved hash, then reconnect.
Quick reference table
| Reason code | Status | Connection closed? | Retryable? |
|---|---|---|---|
unregistered_binary_pending_approval | denied | Yes — immediately | No — requires human approval |
service_not_allowed | denied | No | No — requires policy change |
action_not_in_policy | denied | No | No — requires policy change |
target_not_allowed | denied | No | No — requires policy change |
hash_mismatch_during_fork | denied | Yes — immediately | No — security event |
malformed_request | error | No | Only after fixing the request |
internal_error | error | No | Yes — may be transient |