Mintplex-Labs/anything-llm · error

e.message

Error message

e.message

What it means

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.

Source

Thrown at server/endpoints/utils/outlookAgentUtils.js:167

        const safeConfig = {
          clientId: config.clientId || "",
          tenantId: config.tenantId || "",
          clientSecret: config.clientSecret ? "********" : "",
          authType: config.authType || AUTH_TYPES.common,
        };

        return response.status(200).json({
          success: true,
          isConfigured,
          hasCredentials,
          isAuthenticated: !!config.accessToken,
          tokenExpiry: normalizeTokenExpiry(config.tokenExpiry),
          config: safeConfig,
        });
      } catch (e) {
        console.error("Outlook status error:", e);
        response.status(500).json({ success: false, error: e.message });
      }
    }
  );

  app.post(
    "/admin/agent-skills/outlook/revoke",
    [validatedRequest, isSingleUserMode],
    async (_request, response) => {
      try {
        const outlookLib = require("../../utils/agents/aibitat/plugins/outlook/lib");
        const { SystemSettings } = require("../../models/systemSettings");
        await SystemSettings.delete({ label: "outlook_agent_config" });
        outlookLib.reset();
        return response.status(200).json({ success: true });
      } catch (e) {
        console.error("Outlook revoke error:", e);
        response.status(500).json({ success: false, error: e.message });
      }

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Check the 'Outlook status error:' log line for the root exception message.
  2. Re-authenticate via the auth-url flow (or revoke + reconfigure) to rewrite a clean config row.
  3. Ensure the database is reachable and not exclusively locked, then reload status.
Defensive patterns

Strategy: try-catch

Try / catch

async function outlookStatus(api) {
  try {
    const res = await fetch(`${api}/agent-skills/outlook/status`);
    if (res.status === 500) {
      const { error } = await res.json();
      console.error("Outlook status backend fault:", error); // match against 'Outlook status error:' in server logs
      return null;
    }
    return await res.json();
  } catch { return null; }
}

Prevention

When it happens

Trigger: 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.

Common situations: Polling status during token refresh in another request; hand-edited settings row; version downgrade leaving a newer config shape behind.

Related errors


AI-assisted analysis of Mintplex-Labs/anything-llm@3aec848f28 (2026-08-18). Data as JSON: /api/errors/ec1165fea754347c. Report an issue: GitHub.