{"record":{"id":"ec1165fea754347c","repo":"Mintplex-Labs/anything-llm","slug":"e-message-ec1165","errorCode":null,"errorMessage":"e.message","messagePattern":"e\\.message","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/endpoints/utils/outlookAgentUtils.js","lineNumber":167,"sourceCode":"\n        const safeConfig = {\n          clientId: config.clientId || \"\",\n          tenantId: config.tenantId || \"\",\n          clientSecret: config.clientSecret ? \"********\" : \"\",\n          authType: config.authType || AUTH_TYPES.common,\n        };\n\n        return response.status(200).json({\n          success: true,\n          isConfigured,\n          hasCredentials,\n          isAuthenticated: !!config.accessToken,\n          tokenExpiry: normalizeTokenExpiry(config.tokenExpiry),\n          config: safeConfig,\n        });\n      } catch (e) {\n        console.error(\"Outlook status error:\", e);\n        response.status(500).json({ success: false, error: e.message });\n      }\n    }\n  );\n\n  app.post(\n    \"/admin/agent-skills/outlook/revoke\",\n    [validatedRequest, isSingleUserMode],\n    async (_request, response) => {\n      try {\n        const outlookLib = require(\"../../utils/agents/aibitat/plugins/outlook/lib\");\n        const { SystemSettings } = require(\"../../models/systemSettings\");\n        await SystemSettings.delete({ label: \"outlook_agent_config\" });\n        outlookLib.reset();\n        return response.status(200).json({ success: true });\n      } catch (e) {\n        console.error(\"Outlook revoke error:\", e);\n        response.status(500).json({ success: false, error: e.message });\n      }","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/Mintplex-Labs/anything-llm/blob/3aec848f2885144aa8f1e53b9731a04310d5d558/server/endpoints/utils/outlookAgentUtils.js#L149-L185","documentation":"The 500 reply from GET /agent-skills/outlook/status when the status handler throws. It loads the Outlook config via OutlookBridge.getConfig(), normalizes token expiry, and returns redacted credentials plus isAuthenticated (presence of accessToken); any exception - settings row unreadable, malformed stored JSON, bad tokenExpiry shape - is logged as 'Outlook status error:' and returned as e.message.","triggerScenarios":"Status GET while the outlook_agent_config system settings row is corrupt or the database is locked/offline; a tokenExpiry value in an unexpected format breaking normalizeTokenExpiry; config written by an older incompatible version.","commonSituations":"Polling status during token refresh in another request; hand-edited settings row; version downgrade leaving a newer config shape behind.","solutions":["Check the 'Outlook status error:' log line for the root exception message.","Re-authenticate via the auth-url flow (or revoke + reconfigure) to rewrite a clean config row.","Ensure the database is reachable and not exclusively locked, then reload status."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"async function outlookStatus(api) {\n  try {\n    const res = await fetch(`${api}/agent-skills/outlook/status`);\n    if (res.status === 500) {\n      const { error } = await res.json();\n      console.error(\"Outlook status backend fault:\", error); // match against 'Outlook status error:' in server logs\n      return null;\n    }\n    return await res.json();\n  } catch { return null; }\n}","preventionTips":["Cache status results briefly instead of polling during token-refresh windows.","Re-authenticate when status shows config trouble - it rewrites the config row cleanly.","Do not edit the outlook_agent_config settings row by hand."],"tags":["outlook","status","database","agent-skills"],"backgroundTag":"config-load-failure","analyzedSha":"3aec848f2885144aa8f1e53b9731a04310d5d558","analyzedAt":"2026-08-18T10:02:21.017Z","schemaVersion":2},"datasetVersion":"2026-08-23T13:39:53.451Z"}