pika/pika · error · TimeoutError

{method_name} timed out after {timeout} seconds

Error message

{method_name} timed out after {timeout} seconds

What it means

Error "{method_name} timed out after {timeout} seconds" thrown in pika/pika.

Source

Thrown at pika/adapters/thread_safe_connection.py:477

            def _on_chan_close(ch, reason) -> None:
                if not ready.is_set():
                    if error[0] is None:
                        error[0] = reason
                    ready.set()

            try:
                self._channel.add_on_close_callback(_on_chan_close)
                channel_method(*args, **kwargs, callback=_on_ok)
            except Exception as exc:
                error[0] = exc
                ready.set()

        self._wrapper.add_callback_threadsafe(_invoke)

        try:
            if not ready.wait(timeout=timeout):
                raise TimeoutError(
                    f'{method_name} timed out after {timeout} seconds')
        finally:
            self._unregister_waiter(ready, error)

        if error[0] is not None:
            raise error[0]
        return result[0]

    def basic_publish(self,
                      exchange,
                      routing_key,
                      body,
                      properties=None,
                      mandatory: bool = False,
                      on_publish=None) -> None:
        """
        Schedule a publish in the IOLoop thread (fire-and-forget).

View on GitHub (pinned to 295ad9e579)

When it happens

Trigger: Thrown at pika/adapters/thread_safe_connection.py:477 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of pika/pika@295ad9e579 (2026-08-04). Data as JSON: /data/errors/8cf4105dda57105b.json. Report an issue: GitHub.