Foundry376/Mailspring · error · UsageExceededError
UsageExceededError
UsageExceededError
Error message
UsageExceededError
What it means
Raised by GrammarCheckService.check when the identity backend answers HTTP 400 ('Quota Reached') for POST /api/grammar/check, meaning the account has exhausted its grammar-check quota. It is a sentinel error type the package uses to distinguish quota exhaustion from other failures.
Source
Thrown at app/internal_packages/composer-grammar-check/lib/grammar-check-service.ts:135
this._readConfig();
let data: LanguageToolResponse;
try {
data = await MailspringAPIRequest.makeRequest({
server: 'identity',
method: 'POST',
path: '/api/grammar/check',
json: true,
body: {
messageId,
text,
language: language || this.language,
},
});
} catch (err) {
// 400 = quota reached ("Quota Reached")
if (err.statusCode === 400) {
throw new UsageExceededError();
}
// 429 = rate limited — surface as a transient error, caller will retry on next dirty check
if (err.statusCode === 429) {
throw new Error('Grammar check rate limit reached, please try again shortly.');
}
// 502 = LanguageTool backend unavailable
if (err.statusCode === 502) {
throw new Error('Grammar check service is temporarily unavailable.');
}
throw err;
}
const filtered = data.matches.filter((match) => match.rule.issueType !== 'misspelling');
return filtered.map((match) => ({
offset: match.offset,
length: match.length,
message: match.message,View on GitHub (pinned to 648c685d60)
Solutions
- Surface an inline notice in the composer that the free grammar-check quota is used up and offer a link to upgrade or wait for the quota window to reset
- Cache the UsageExceededError state so subsequent dirty checks skip the API call until the window resets
Defensive patterns
Strategy: try-catch
When it happens
Trigger: Thrown at app/internal_packages/composer-grammar-check/lib/grammar-check-service.ts:135 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of Foundry376/Mailspring@648c685d60 (2026-09-03).
Data as JSON: /api/errors/caf67939c75358b3.
Report an issue: GitHub.