TypeError: object bool can't be used in 'await' expression

Open Beginner friendly
#10 1 comment 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
72/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python
Domain
backend

Research direction

Start in client.py at the await of _event_registry.handle_event and compare it with the synchronous handle_event definition. Trace the event path and confirm the change removes the TypeError while preserving the boolean handling result and event-handler error behavior. Done means CDP events no longer await a synchronous boolean result.

Written by the indexing model from the issue text.

Description

Seems like its happening due to use of await on synchronous handle_event in the client.py

handled = await self._event_registry.handle_event(
    method, params, session_id
)
def handle_event(
    self,
    method: str,
    params: Any,
    session_id: Optional[str] = None,
) -> bool:
    """
    Handle an incoming CDP event.
    ...
    Returns:
        True if a handler was found and called, False otherwise
    """
    if method in self._handlers:
        try:
            self._handlers[method](params, session_id)
            return True
        except Exception as e:
            logger.error(f"Error in event handler for {method}: {e}")
            return False
    return False
Dominant language
Python
Stars
323
Forks
38
PR merge metrics
No merged PRs in 30d

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from browser-use/cdp-use

All issues in browser-use/cdp-use

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.