paul-gauthier / aider

aider is AI pair programming in your terminal
https://aider.chat/
Apache License 2.0
18.63k stars 1.72k forks source link

Uncaught ValueError in _config.py line 338 #1541

Open liusuitanggithub opened 4 days ago

liusuitanggithub commented 4 days ago

Aider version: 0.55.0 Python version: 3.11.9 Platform: Linux-6.8.0-40-generic-x86_64-with-glibc2.35 Python implementation: CPython Virtual environment: No OS: Linux 6.8.0-40-generic (64bit) Git version: git version 2.34.1

An uncaught exception occurred:

Traceback (most recent call last):
  File "aider", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "main.py", line 510, in main
    register_models(git_root, args.model_settings_file, io, verbose=args.verbose)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "models.py", line 486, in __init__
    # Are all needed keys/params available?
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "models.py", line 660, in validate_environment
    model = self.name
          ^^^^^^^^^^^^
  File "llm.py", line 23, in __getattr__
    self._load_litellm()
  File "llm.py", line 30, in _load_litellm
    self._lazy_module = importlib.import_module("litellm")
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1204, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 940, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "__init__.py", line 261, in <module>
    module_level_aclient = AsyncHTTPHandler(timeout=request_timeout)
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "http_handler.py", line 30, in __init__
    self.client = self.create_client(
                  ^^^^^^^^^^^^^^^^^^^
  File "http_handler.py", line 55, in create_client
    return httpx.AsyncClient(
           ^^^^^^^^^^^^^^^^^^
  File "_client.py", line 1440, in __init__
    proxy_map = self._get_proxy_map(proxies or proxy, allow_env_proxies)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "_client.py", line 218, in _get_proxy_map
    return {
           ^
  File "_client.py", line 219, in <dictcomp>
    key: None if url is None else Proxy(url=url)
                                  ^^^^^^^^^^^^^^
  File "_config.py", line 338, in __init__
    raise ValueError(f"Unknown scheme for proxy URL {url!r}")
ValueError: Unknown scheme for proxy URL URL('socks://127.0.0.1:7891/')
fry69 commented 4 days ago

Thank you for filing this issue.

The error you provided

ValueError: Unknown scheme for proxy URL URL('socks://127.0.0.1:7891/

seems to indicate that you are trying to setup a proxy for using an LLM endpoint. I don't know if this is supported in LiteLLM (I couldn't find docs on this on their site), or how this works with httpx, which LiteLLM uses. Especially I do not know how to configure this.

If you can get this to work, please report how you got it working, it may help others who are trying the same.

Thank you.

liusuitanggithub commented 3 days ago

Thank you