Skip to main content

Troubleshooting

Common integration issues and solutions.

OAuth Errors​

invalid_grant​

Error:

{
"error": "invalid_grant",
"error_description": "Authorization code is invalid or expired"
}

Causes:

  1. Authorization code already used (codes are single-use)
  2. Code expired (5-minute lifetime)
  3. PKCE code_verifier doesn't match code_challenge
  4. redirect_uri doesn't match authorization request

invalid_client​

Error:

{
"error": "invalid_client",
"error_description": "Client authentication failed"
}

Causes:

  1. client_id doesn't exist
  2. client_id not 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:

  1. Refresh token expired
  2. Refresh token already used (rotation)
  3. 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:

  1. Access token missing
  2. Access token expired
  3. Bearer token format incorrect
  4. 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:

  1. Data processing not complete
  2. No matching documents
  3. Query too specific

Fetch Returns not_found​

Error:

{
"jsonrpc": "2.0",
"id": 1,
"error": {
"code": -32002,
"message": "Document not found"
}
}

Causes:

  1. Invalid uri parameter
  2. Document doesn't belong to patient
  3. URI format incorrect

Next Steps​