Reference
Error Codes
Error responses and handling
Error Codes
LawForge returns structured error responses for all failure cases.
Error Response Format
{
"error": {
"code": "rate_limit_exceeded",
"message": "Rate limit exceeded. Please wait 60 seconds."
}
}Error Codes
| Code | HTTP Status | Description |
|---|---|---|
invalid_query | 400 | Malformed query parameters |
invalid_citation | 400 | Citation format not recognized |
missing_parameter | 400 | Required parameter not provided |
unauthorized | 401 | Authentication required |
forbidden | 403 | Access denied |
document_not_found | 404 | Document doesn't exist |
rate_limit_exceeded | 429 | Too many requests |
server_error | 500 | Internal error |
service_unavailable | 503 | Service temporarily unavailable |
Handling Errors
Rate Limits
When you receive rate_limit_exceeded:
- Check the
Retry-Afterheader for wait time - Implement exponential backoff
- Consider upgrading your plan for higher limits
if (error.code === "rate_limit_exceeded") {
const retryAfter = response.headers.get("Retry-After") || "60";
await sleep(parseInt(retryAfter) * 1000);
// Retry request
}Not Found
When document_not_found is returned:
- Verify the document ID is correct
- The document may not exist in our database
- Try searching by case name instead
Invalid Query
When invalid_query is returned:
- Check query syntax
- Verify parameter types match the schema
- Review the specific error message for details
MCP Error Responses
MCP tools return errors in this format:
{
"isError": true,
"content": [
{
"type": "text",
"text": "Error: Rate limit exceeded. Please wait 60 seconds."
}
]
}