{"record":{"id":"f0df261df8eb1365","repo":"Mintplex-Labs/anything-llm","slug":"e-message-f0df26","errorCode":null,"errorMessage":"${e.message}","messagePattern":"\\$\\{e\\.message\\}","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/endpoints/utils/outlookAgentUtils.js","lineNumber":84,"sourceCode":"          delete configUpdate.refreshToken;\n          delete configUpdate.tokenExpiry;\n        }\n\n        await outlookLib.OutlookBridge.updateConfig(configUpdate);\n        outlookLib.reset();\n\n        const redirectUri = getOutlookRedirectUri(request);\n        const result = await outlookLib.getAuthUrl(redirectUri);\n        if (!result.success) {\n          return response\n            .status(400)\n            .json({ success: false, error: result.error });\n        }\n\n        return response.status(200).json({ success: true, url: result.url });\n      } catch (e) {\n        console.error(\"Outlook auth URL error:\", e);\n        response.status(500).json({ success: false, error: e.message });\n      }\n    }\n  );\n\n  app.get(\n    \"/agent-skills/outlook/auth-callback\",\n    [validatedRequest, isSingleUserMode],\n    async (request, response) => {\n      try {\n        const { code, error, error_description } = request.query;\n\n        if (error) {\n          console.error(\"Outlook OAuth error:\", error, error_description);\n          return response.redirect(\n            `/?outlook_auth=error&message=${encodeURIComponent(error_description || error)}`\n          );\n        }\n","sourceCodeStart":66,"sourceCodeEnd":102,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/endpoints/utils/outlookAgentUtils.js#L66-L102","documentation":"The 500 reply from POST /admin/agent-skills/outlook/auth-url when the handler itself throws. The try block spans the lazy require of the Outlook lib, OutlookBridge.updateConfig (a system_settings database write), reset(), and getAuthUrl(); any exception there is logged as 'Outlook auth URL error:' and returned as e.message. Unlike the 400 path, this indicates an unexpected server-side fault, most often a database write failure while persisting the Outlook config.","triggerScenarios":"updateConfig throwing on a locked/read-only SQLite database; a broken require of the outlook plugin module (incomplete deployment); an unhandled exception inside getAuthUrl beyond its own guards (e.g. malformed authority from corrupt config).","commonSituations":"DB locked by a concurrent admin save; storage volume full or permission-stripped; deploying a partial build where the outlook lib files are missing.","solutions":["Read the 'Outlook auth URL error:' console line for the actual exception.","Free/write-enable the database (single writer process, writable storage dir, free disk) and retry the auth-url request.","Reinstall/redeploy cleanly if the require itself failed, so the outlook plugin module loads."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try {\n  const res = await fetch(\"/api/admin/agent-skills/outlook/auth-url\", { method: \"POST\", headers, body: JSON.stringify(validatedBody) });\n  if (res.status === 500) {\n    const { error } = await res.json(); // server fault (DB write / module load), see 'Outlook auth URL error:' log\n    console.error(\"auth-url backend fault:\", error);\n  }\n} catch (e) { console.error(\"auth-url request failed:\", e.message); }","preventionTips":["Validate the body client-side first so only genuine server faults reach the 500 path.","Keep database and storage writable and single-writer to avoid updateConfig throws.","Deploy complete builds - the lazy require of the outlook lib fails loudly on partial deploys."],"tags":["outlook","oauth","database","internal-error"],"backgroundTag":"oauth-setup-failure","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-08-23T13:39:53.451Z"}