Mintplex-Labs/anything-llm · error

${e.message}

Error message

${e.message}

What it means

The 500 reply from GET /admin/agent-skills/gmail/status when anything throws inside the handler. The try block calls GoogleAgentSkill/GmailBridge config loading (a system_settings database read) and builds a redacted config; any exception - failed DB read, malformed stored JSON for the gmail_agent_config setting, or an unexpected shape - is logged as 'Gmail status error:' and returned as e.message.

Source

Thrown at server/endpoints/utils/googleAgentSkillEndpoints.js:36

        const config = await GmailBridge.getConfig();

        const hasDeploymentId = !!config.deploymentId;
        const hasApiKey = !!config.apiKey;
        const isConfigured = hasDeploymentId && hasApiKey;

        const safeConfig = {
          deploymentId: config.deploymentId || "",
          apiKey: hasApiKey ? "********" : "",
        };

        return response.status(200).json({
          success: true,
          isConfigured,
          config: safeConfig,
        });
      } catch (e) {
        console.error("Gmail status error:", e);
        response.status(500).json({ success: false, error: e.message });
      }
    }
  );

  app.get(
    "/admin/agent-skills/google-calendar/status",
    [validatedRequest, isSingleUserMode],
    async (_request, response) => {
      try {
        const config = await GoogleCalendarBridge.getConfig();

        const hasDeploymentId = !!config.deploymentId;
        const hasApiKey = !!config.apiKey;
        const isConfigured = hasDeploymentId && hasApiKey;

        const safeConfig = {
          deploymentId: config.deploymentId || "",
          apiKey: hasApiKey ? "********" : "",

View on GitHub (pinned to 3aec848f28)

Solutions

  1. Check server logs for the 'Gmail status error:' line to see the underlying e.message (DB error vs JSON parse error).
  2. If the stored gmail config is corrupted, clear/re-save the Gmail agent skill settings from the admin UI to rewrite a clean row.
  3. Verify the database/storage mount is healthy and not locked by another process, then reload the status endpoint.
Defensive patterns

Strategy: try-catch

Try / catch

async function gmailStatus(api) {
  try {
    const res = await fetch(`${api}/admin/agent-skills/gmail/status`);
    if (res.status === 500) {
      const { error } = await res.json();
      console.error("Gmail status backend fault:", error); // check server log for 'Gmail status error:'
      return null;
    }
    return await res.json();
  } catch { return null; }
}

Prevention

When it happens

Trigger: GET /admin/agent-skills/gmail/status while the system settings row is unreadable: database locked/offline, a corrupted or hand-edited gmail_agent_config value whose JSON parse throws, or a partially migrated schema.

Common situations: Status probe fired right at server boot before the DB is ready; settings row written by an older version with a different shape; storage permission issues after moving the data directory.

Related errors


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