{"record":{"id":"54c792838bf12262","repo":"infiniflow/ragflow","slug":"whatsapp-session-is-not-running","errorCode":null,"errorMessage":"WhatsApp session is not running.","messagePattern":"WhatsApp session is not running\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"api/channels/whatsapp/gateway-node/index.js","lineNumber":326,"sourceCode":"      this.events.push(event);\n      this.messageStore.set(key.id, message);\n      this.broadcast({ type: 'event', data: event });\n      if (this.events.length > 1000) {\n        const dropped = this.events.slice(0, this.events.length - 500);\n        this.events = this.events.slice(-500);\n        for (const oldEvent of dropped) {\n          if (oldEvent.kind === 'message' && oldEvent.message_id) {\n            this.messageStore.delete(oldEvent.message_id);\n          }\n        }\n      }\n      this.lastSnapshotAt = now();\n    }\n  }\n\n  async send(payload) {\n    if (!this.sock) {\n      throw new Error('WhatsApp session is not running.');\n    }\n    const jid = normalizeJid(payload.chat_id);\n    if (!jid) {\n      throw new Error(`Invalid chat_id: ${payload.chat_id}`);\n    }\n    const text = String(payload.text || '');\n    const options = {};\n    if (payload.reply_to_message_id) {\n      const quoted = this.messageStore.get(String(payload.reply_to_message_id));\n      if (quoted) {\n        options.quoted = quoted;\n      }\n    }\n    await this.sock.sendMessage(jid, { text }, options);\n    this.lastSnapshotAt = now();\n  }\n\n  async stop() {","sourceCodeStart":308,"sourceCodeEnd":344,"githubUrl":"https://github.com/infiniflow/ragflow/blob/554fb1133ac3861732235ad9c377eb5e0a770665/api/channels/whatsapp/gateway-node/index.js#L308-L344","documentation":"Catch-all: any exception during validate_connector_settings that is not a gitlab-auth/authz/get error — most often network-layer failures (DNS, TLS, proxy, connection refused) or URL misconfiguration — is re-raised as UnexpectedValidationError with the original message embedded.","triggerScenarios":"gitlab_instance_url unreachable/wrong (self-hosted host down, bad scheme, http vs https), SSL cert verification failure against a private CA, corporate proxy blocking the egress, python-gitlab raising requests.ConnectionError/SSLError, or a response that is not valid JSON (auth portal hijacking the API).","commonSituations":"Self-hosted GitLab behind an internal CA without the CA cert in the trust store, instance URL entered without https:// or pointing to the web root plus /api/v4 duplicated, transient DNS failures, GitLab returning an HTML login page with 200 which breaks json parsing.","solutions":["Read the embedded {e} message — it names the real cause (SSLError, ConnectionError, etc.)","Verify reachability from the indexer host: curl -v <gitlab_instance_url>/api/v4/version with the token","For private CAs set REQUESTS_CA_BUNDLE to the CA bundle path","Correct the gitlab_instance_url credential to the scheme+host only (python-gitlab appends /api/v4 itself)"],"exampleFix":"# before: double /api/v4 and plain http behind TLS terminator\nconnector_credential = GitlabCredentialConfig(url=\"https://git.acme.com/api/v4\")\n\n# after: scheme + host only\nconnector_credential = GitlabCredentialConfig(url=\"https://git.acme.com\")","handlingStrategy":"try-catch","validationCode":"import socket, ssl, requests\n\ndef gitlab_reachable(base_url: str) -> bool:\n    try:\n        requests.get(base_url.rstrip('/') + \"/api/v4/version\", timeout=5,\n                     verify=True)\n        return True\n    except (requests.SSLError, requests.ConnectionError):\n        return False","typeGuard":null,"tryCatchPattern":"from common.data_source.exceptions import UnexpectedValidationError\n\ntry:\n    connector.validate_connector_settings()\nexcept UnexpectedValidationError as e:\n    logger.error(\"raw cause: %s\", e.__cause__)  # inspect original exception\n    if isinstance(e.__cause__, (requests.SSLError, requests.ConnectionError)):\n        schedule_retry_with_backoff()  # network issue → retry later\n    else:\n        raise","preventionTips":["Add the private CA to the trust store or set REQUESTS_CA_BUNDLE for self-hosted instances","Store only scheme+host in gitlab_instance_url; python-gitlab appends the API path","Wrap validate in retries with backoff for transient DNS/TLS failures"],"tags":["gitlab","network","ssl","configuration","connector","catch-all"],"backgroundTag":null,"analyzedSha":"554fb1133ac3861732235ad9c377eb5e0a770665","analyzedAt":"2026-08-15T09:20:16.380Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}