infiniflow/ragflow · error · ValueError

WhatsApp gateway_base_url is required

Error message

WhatsApp gateway_base_url is required

What it means

Error "WhatsApp gateway_base_url is required" thrown in infiniflow/ragflow.

Source

Thrown at api/channels/whatsapp/channel.py:78

        self._qr_data_url: str = ""
        self._qr_updated_at: float = 0.0
        self._connected_at: float = 0.0
        self._last_snapshot_at: float = 0.0
        self._session_id: str = ""
        self._event_cursor: int = 0
        self._seen_message_ids: dict[str, float] = {}

    def _session_key(self) -> str:
        value = str(self.account.session_key or "").strip()
        return value or WHATSAPP_DEFAULT_SESSION_KEY

    def _gateway_base_url(self) -> str:
        return str(self.account.gateway_base_url or "").strip().rstrip("/")

    def _gateway_url(self, path: str) -> str:
        base_url = self._gateway_base_url()
        if not base_url:
            raise ValueError("WhatsApp gateway_base_url is required")
        return f"{base_url}/{path.lstrip('/')}"

    def _events_ws_url(self) -> str:
        base_url = self._gateway_base_url()
        if not base_url:
            raise ValueError("WhatsApp gateway_base_url is required")
        if base_url.startswith("http://"):
            ws_base = f"ws://{base_url.removeprefix('http://')}"
        elif base_url.startswith("https://"):
            ws_base = f"wss://{base_url.removeprefix('https://')}"
        else:
            ws_base = base_url
        return f"{ws_base}/whatsapp/{self._session_key()}/events/ws?after={self._event_cursor}"

    def _gateway_headers(self) -> dict[str, str]:
        token = str(self.account.gateway_token or "").strip()
        if not token:
            return {}

View on GitHub (pinned to 554fb1133a)

Solutions

  1. Set gateway_base_url in the WhatsApp channel configuration.

Example fix

config = {'gateway_base_url': 'http://127.0.0.1:3000'}

When it happens

Trigger: Thrown at api/channels/whatsapp/channel.py:78 when the library encounters an invalid state.

Common situations: The WhatsApp channel is enabled without configuring the gateway base URL; adding the gateway address prevents this error.


AI-assisted analysis of infiniflow/ragflow@554fb1133a (2026-08-15). Data as JSON: /api/errors/b2e706ab0bf81735. Report an issue: GitHub.