n8n-io/n8n · error · NodeOperationError
Error: ${errorData.error}
Error message
Error: ${errorData.error} What it means
Structured-error branch of the Microsoft 365 Agent trigger webhook catch block. When a thrown error has error.response.data shaped like { error, error_description } (OAuth/Graph-style error envelope), the node formats 'Error: <error>' as the message and uses error_description (falling back to error.message) as the description, then rethrows as NodeOperationError.
Source
Thrown at packages/@n8n/nodes-langchain/nodes/vendors/Microsoft/MicrosoftAgent365Trigger.node.ts:284
output: activityCapture.output,
...activity,
...(activityCapture.mcpToolLogs?.length
? { microsoftMcpToolLogs: activityCapture.mcpToolLogs }
: {}),
};
}
return {
noWebhookResponse: true,
workflowData: [this.helpers.returnJsonArray({ ...returnData })],
};
} catch (error) {
const errorData = error.response?.data;
if (typeof errorData === 'object' && 'error' in errorData) {
const message = 'Error: ' + String(errorData.error);
const description = (errorData.error_description as string) ?? error.message;
throw new NodeOperationError(node, message, { description });
}
throw new NodeOperationError(node, error.message);
}
}
}
View on GitHub (pinned to 5ac6606e81)
Solutions
- Read the description (error_description) — AADSTS codes pinpoint the cause (expired secret, consent, scope).
- Renew the client secret in Azure and update the microsoftAgent365Api credential if 'invalid_client' / secret expiry.
- Grant/admin-consent the required Graph application permissions if 'invalid_grant' / 'consent_required'.
- Re-test the credential via the n8n credential editor's 'Save and Test'.
Defensive patterns
Strategy: try-catch
Type guard
interface OAuthErrorEnvelope { error: string; error_description?: string }
function isOAuthErrorEnvelope(data: unknown): data is OAuthErrorEnvelope {
return !!data && typeof data === 'object' && typeof (data as { error?: unknown }).error === 'string';
} Try / catch
try {
await webhook();
} catch (e) {
const data = (e as { response?: { data?: unknown } }).response?.data;
if (isOAuthErrorEnvelope(data)) {
// map known AADSTS codes: invalid_client → renew secret; invalid_grant → admin consent
handle AadError(data.error, data.error_description);
}
throw e;
} Prevention
- Rotate the Azure client secret before expiry and update the credential promptly.
- Admin-consent all required Graph application permissions up front.
- Use 'Save and Test' in the credential editor to surface OAuth errors at config time.
When it happens
Trigger: Microsoft Graph / Bot Framework token or messaging call returns an OAuth error envelope, e.g. invalid_grant, invalid_client, AADSTS token errors, consent required, expired secret, or a Graph API permission error. Anything inside agent.adapter.process that surfaces as an Axios-style error with response.data.error.
Common situations: Expired client secret in the Azure app registration; missing application permissions / admin consent on Graph scopes; tenant misconfigured; token endpoint unreachable.
Related errors
- ${error.message}
- ${response.error.message}
- ${uploadResponse.file.error?.message ?? 'Unknown error'}
- Failed to get upload URL
- ${file.error?.message ?? 'Unknown error'}
AI-assisted analysis of n8n-io/n8n@5ac6606e81 (2026-08-12).
Data as JSON: /api/errors/4c4927bca32fa09f.
Report an issue: GitHub.