FlowiseAI/Flowise · error · Error
Graph API Error ${response.status}: ${response.statusText} -
Error message
Graph API Error ${response.status}: ${response.statusText} - ${errorText} What it means
Thrown by OutlookAPI.makeGraphRequest when the fetch to Microsoft Graph returns a non-OK HTTP status. The message includes status code, statusText, and the raw response body (errorText) so the caller can see Graph's own error JSON. The request always sends Authorization: Bearer <accessToken> and JSON content type.
Source
Thrown at packages/components/nodes/tools/MicrosoftOutlook/core.ts:158
this.accessToken = args.accessToken ?? ''
}
async makeGraphRequest(url: string, method: string = 'GET', body?: any, params?: any): Promise<string> {
const headers = {
Authorization: `Bearer ${this.accessToken}`,
'Content-Type': 'application/json',
...this.headers
}
const response = await fetch(url, {
method,
headers,
body: body ? JSON.stringify(body) : undefined
})
if (!response.ok) {
const errorText = await response.text()
throw new Error(`Graph API Error ${response.status}: ${response.statusText} - ${errorText}`)
}
const data = await response.text()
return data + TOOL_ARGS_PREFIX + JSON.stringify(params)
}
parseEmailAddresses(emailString: string) {
return emailString.split(',').map((email) => ({
emailAddress: {
address: email.trim(),
name: email.trim()
}
}))
}
}
// Calendar Tools
class ListCalendarsTool extends BaseOutlookTool {View on GitHub (pinned to abe4a8601a)
Solutions
- Inspect status: 401 -> ensure refreshOAuth2Token ran and the credential has a refresh_token; 403 -> add the required Graph permission scopes and re-consent; 404 -> verify the resource id; 429 -> honor Retry-After.
- Surface errorText to identify Graph's specific error code (e.g. 'code': 'InvalidAuthenticationToken').
- For 5xx, retry with backoff; for persistent failures check the Microsoft 365 service health.
Example fix
// before
const data = await outlook.makeGraphRequest(url, 'POST', body)
// after: handle 401 by refreshing and retrying once
try {
return await outlook.makeGraphRequest(url, 'POST', body)
} catch (e) {
if (/Graph API Error 401/.test(e.message)) {
await refreshOAuth2Token(credId, credData, options)
return await outlook.makeGraphRequest(url, 'POST', body)
}
throw e
} Defensive patterns
Strategy: retry
Validate before calling
// Pre-flight: confirm token present and scopes likely sufficient before the call.
if (!accessToken) throw new Error('No access token')
// Best-effort URL/method validation before fetch
if (!url.startsWith('https://graph.microsoft.com/')) throw new Error('URL must target Graph') Type guard
const isGraphError = (e: unknown): boolean =>
e instanceof Error && /^Graph API Error \d{3}:/.test(e.message) Try / catch
try {
return await outlook.makeGraphRequest(url, method, body, params)
} catch (e) {
if (/Graph API Error 401/.test(e.message)) {
await refreshOAuth2Token(credId, credData, options)
return await outlook.makeGraphRequest(url, method, body, params) // one retry
}
if (/Graph API Error 429/.test(e.message)) {
// honor Retry-After, then retry
}
throw e
} Prevention
- Keep OAuth refresh enabled so 401s self-heal.
- Request only the Graph scopes each action needs and re-consent when adding actions.
- Implement throttling/backoff for 429 and circuit-breaking for sustained 5xx.
When it happens
Trigger: Any Graph call (calendar/message actions) where response.ok is false: 401 (expired/invalid token), 403 (insufficient scopes), 404 (resource not found), 429 (throttled), 5xx (Graph outage), or 400 (malformed body/URL).
Common situations: Access token expired (401) — refresh cycle not running; missing Microsoft Graph scopes such as Calendars.ReadWrite or Mail.Send (403); invalid event/message id (404); throttling during bulk operations (429).
Related errors
- ${errorMessage}
- HTTP error! status: ${response.status}
- Failed to fetch ${url}: ${error}
- Failed to post ${url}: ${error}
- Azure Rerank API call failed: ${error.message}
AI-assisted analysis of FlowiseAI/Flowise@abe4a8601a (2026-08-12).
Data as JSON: /api/errors/e7072398f17e21e8.
Report an issue: GitHub.