Mintplex-Labs/anything-llm · error

${e.message}

Error message

${e.message}

What it means

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.

Source

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

          delete configUpdate.refreshToken;
          delete configUpdate.tokenExpiry;
        }

        await outlookLib.OutlookBridge.updateConfig(configUpdate);
        outlookLib.reset();

        const redirectUri = getOutlookRedirectUri(request);
        const result = await outlookLib.getAuthUrl(redirectUri);
        if (!result.success) {
          return response
            .status(400)
            .json({ success: false, error: result.error });
        }

        return response.status(200).json({ success: true, url: result.url });
      } catch (e) {
        console.error("Outlook auth URL error:", e);
        response.status(500).json({ success: false, error: e.message });
      }
    }
  );

  app.get(
    "/agent-skills/outlook/auth-callback",
    [validatedRequest, isSingleUserMode],
    async (request, response) => {
      try {
        const { code, error, error_description } = request.query;

        if (error) {
          console.error("Outlook OAuth error:", error, error_description);
          return response.redirect(
            `/?outlook_auth=error&message=${encodeURIComponent(error_description || error)}`
          );
        }

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Read the 'Outlook auth URL error:' console line for the actual exception.
  2. Free/write-enable the database (single writer process, writable storage dir, free disk) and retry the auth-url request.
  3. Reinstall/redeploy cleanly if the require itself failed, so the outlook plugin module loads.
Defensive patterns

Strategy: try-catch

Try / catch

try {
  const res = await fetch("/api/admin/agent-skills/outlook/auth-url", { method: "POST", headers, body: JSON.stringify(validatedBody) });
  if (res.status === 500) {
    const { error } = await res.json(); // server fault (DB write / module load), see 'Outlook auth URL error:' log
    console.error("auth-url backend fault:", error);
  }
} catch (e) { console.error("auth-url request failed:", e.message); }

Prevention

When it happens

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

Common situations: DB locked by a concurrent admin save; storage volume full or permission-stripped; deploying a partial build where the outlook lib files are missing.

Related errors


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