aider icon indicating copy to clipboard operation
aider copied to clipboard

Uncaught ValueError in _config.py line 338

Open Marxin1992 opened this issue 1 year ago • 1 comments

Aider version: 0.56.0 Python version: 3.12.4 Platform: Linux-6.8.0-44-generic-x86_64-with-glibc2.39 Python implementation: CPython Virtual environment: No OS: Linux 6.8.0-44-generic (64bit) Git version: git version 2.43.0

An uncaught exception occurred:

Traceback (most recent call last):
  File "aider", line 8, in <module>
    sys.exit(main())
             ^^^^^^
  File "main.py", line 518, in main
    main_model = models.Model(args.model, weak_model=args.weak_model)
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "models.py", line 487, in __init__
    res = self.validate_environment()
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "models.py", line 661, in validate_environment
    res = litellm.validate_environment(model)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  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 90, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "<frozen importlib._bootstrap>", line 1387, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1360, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1331, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 935, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 995, in exec_module
  File "<frozen importlib._bootstrap>", line 488, 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 219, in _get_proxy_map
    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:7897/')

Marxin1992 avatar Sep 16 '24 01:09 Marxin1992

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 (1), 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.

(1) aider uses LiteLLM to talk to LLM endpoints, but I couldn't find docs on how to setup a classic HTTP proxy for this on their site

fry69 avatar Sep 16 '24 04:09 fry69

This looks like a duplicate of #1541, so I'm going to close it so discussion can happen there. Please let me know if you think it's actually a distinct issue.

paul-gauthier avatar Sep 20 '24 18:09 paul-gauthier