Troubleshooting
Common integration issues and solutions.
OAuth Errors
invalid_grant
Error:
{
"error": "invalid_grant",
"error_description": "Authorization code is invalid or expired"
}
Causes:
- Authorization code already used (codes are single-use)
- Code expired (5-minute lifetime)
- PKCE
code_verifierdoesn't matchcode_challenge redirect_uridoesn't match authorization request
invalid_client
Error:
{
"error": "invalid_client",
"error_description": "Client authentication failed"
}
Causes:
client_iddoesn't existclient_idnot registered
invalid_request - Missing PKCE
Error:
{
"error": "invalid_request",
"error_description": "code_challenge required"
}
Token refresh fails
Error:
{
"error": "invalid_grant",
"error_description": "Refresh token is invalid or expired"
}
Causes:
- Refresh token expired
- Refresh token already used (rotation)
- Refresh token revoked
MCP Errors
401 Unauthorized
Error:
HTTP/1.1 401 Unauthorized
WWW-Authenticate: Bearer error="invalid_token", resource_metadata="https://api.healthex.io/.well-known/oauth-protected-resource"
Content-Type: application/json
{
"error": "unauthorized",
"code": "invalid_token"
}
This is an HTTP error, not a JSON-RPC error. When the token is missing, the response has no code and the WWW-Authenticate header has no error.
Causes:
- Access token missing
- Access token expired
- Bearer token format incorrect
- For an organization API token: the API key was deleted
400 JSON-RPC batch rejected
Error:
{
"jsonrpc": "2.0",
"error": {
"code": -32600,
"message": "Invalid Request: JSON-RPC batch requests are not supported"
},
"id": null
}
Batch requests (a JSON array body) are not supported. Send each JSON-RPC message in its own HTTP request.
Search returns no results
Symptoms:
{
"jsonrpc": "2.0",
"id": 1,
"result": {
"content": [
{
"type": "text",
"text": "[]"
}
]
}
}
Causes:
- Data processing not complete
- No matching documents
- Query too specific
Fetch Returns not_found
Error:
{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32002,
"message": "Document not found"
}
}
Causes:
- Invalid
uriparameter - Document doesn't belong to patient
- URI format incorrect
Next Steps
- OAuth Authentication Flow: Authentication implementation guide
- MCP Server Tools: Complete tools documentation