Skip to content

UnboundLocalError: cannot access local variable 'proxy_string' where it is not associated with a value #4449

Description

@montovaneli

Summary

Passing proxy= as a keyword argument to CDP Mode (sb_cdp.Chrome / cdp_util.start) raises UnboundLocalError for non-authenticated proxies (no @ in the string).

Environment

  • SeleniumBase: latest
  • Python: 3.13
  • OS: Linux (Ubuntu)
  • Mode: CDP Mode via sb_cdp.Chrome(...)

Steps to reproduce

from seleniumbase import sb_cdp
sb = sb_cdp.Chrome(
    url="https://example.com",
    proxy="http://127.0.0.1:8080",
)

I think there’s an issue in this elif branch. It looks like proxy_string may not have been initialized at that point, so the validation should probably use proxy instead:

elif proxy:
    proxy = proxy_helper.validate_proxy_string(proxy_string)  # bug: should be `proxy`

Metadata

Metadata

Assignees

No one assigned

    Labels

    UC Mode / CDP ModeUndetected Chromedriver Mode / CDP ModebugUh oh... Something needs to be fixed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions