{"record":{"id":"4c4927bca32fa09f","repo":"n8n-io/n8n","slug":"error-errordata-error","errorCode":null,"errorMessage":"Error: ${errorData.error}","messagePattern":"Error: (.+?)","errorType":"exception","errorClass":"NodeOperationError","httpStatus":null,"severity":"error","filePath":"packages/@n8n/nodes-langchain/nodes/vendors/Microsoft/MicrosoftAgent365Trigger.node.ts","lineNumber":284,"sourceCode":"\t\t\t\t\toutput: activityCapture.output,\n\t\t\t\t\t...activity,\n\t\t\t\t\t...(activityCapture.mcpToolLogs?.length\n\t\t\t\t\t\t? { microsoftMcpToolLogs: activityCapture.mcpToolLogs }\n\t\t\t\t\t\t: {}),\n\t\t\t\t};\n\t\t\t}\n\n\t\t\treturn {\n\t\t\t\tnoWebhookResponse: true,\n\t\t\t\tworkflowData: [this.helpers.returnJsonArray({ ...returnData })],\n\t\t\t};\n\t\t} catch (error) {\n\t\t\tconst errorData = error.response?.data;\n\t\t\tif (typeof errorData === 'object' && 'error' in errorData) {\n\t\t\t\tconst message = 'Error: ' + String(errorData.error);\n\t\t\t\tconst description = (errorData.error_description as string) ?? error.message;\n\n\t\t\t\tthrow new NodeOperationError(node, message, { description });\n\t\t\t}\n\n\t\t\tthrow new NodeOperationError(node, error.message);\n\t\t}\n\t}\n}\n","sourceCodeStart":266,"sourceCodeEnd":291,"githubUrl":"https://github.com/n8n-io/n8n/blob/5ac6606e81f67bb9534255570cd4e86fd8101eee/packages/@n8n/nodes-langchain/nodes/vendors/Microsoft/MicrosoftAgent365Trigger.node.ts#L266-L291","documentation":"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.","triggerScenarios":"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.","commonSituations":"Expired client secret in the Azure app registration; missing application permissions / admin consent on Graph scopes; tenant misconfigured; token endpoint unreachable.","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'."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":"interface OAuthErrorEnvelope { error: string; error_description?: string }\nfunction isOAuthErrorEnvelope(data: unknown): data is OAuthErrorEnvelope {\n  return !!data && typeof data === 'object' && typeof (data as { error?: unknown }).error === 'string';\n}","tryCatchPattern":"try {\n  await webhook();\n} catch (e) {\n  const data = (e as { response?: { data?: unknown } }).response?.data;\n  if (isOAuthErrorEnvelope(data)) {\n    // map known AADSTS codes: invalid_client → renew secret; invalid_grant → admin consent\n    handle AadError(data.error, data.error_description);\n  }\n  throw e;\n}","preventionTips":["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."],"tags":["microsoft","bot-framework","oauth","graph-api","azure-ad","api-error","node-operation-error"],"backgroundTag":null,"analyzedSha":"5ac6606e81f67bb9534255570cd4e86fd8101eee","analyzedAt":"2026-08-12T05:26:35.080Z","schemaVersion":2},"datasetVersion":"2026-08-13T14:17:21.547Z"}