Aider-AI / aider

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

Uncaught AttributeError in sendchat.py line 30 #1901

Closed delinecnlin closed 1 month ago

delinecnlin commented 1 month ago

Aider version: 0.58.1 Python version: 3.12.4 Platform: Windows-11-10.0.22631-SP0 Python implementation: CPython Virtual environment: No OS: Windows 11 (64bit) Git version: git version 2.45.2.windows.1

At first it was happened suddenly with the red exception:

Unexpected error: litellm.AuthenticationError: AzureException AuthenticationError - Error code: 401 - {'statusCode':
401, 'message': 'Unauthorized. Access token is missing, invalid, audience is incorrect
(https://cognitiveservices.azure.com), or have expired.'}

But I confirmed that all the credetials are correct.

fry69 commented 1 month ago

Thank you for filing this issue.

But I confirmed that all the credetials are correct.

It seems Azure disagrees:

Unauthorized. Access token is missing, invalid, audience is incorrect (https://cognitiveservices.azure.com/), or have expired.

Please check if you followed the instructions correctly -> https://aider.chat/docs/llms/azure.html

delinecnlin commented 1 month ago

OK, now I can give more details. Within another project folder it works. But only in one project folder it will come out this error. So the credentials must be right according to the documentation you gave for Azure. I thought that maybe because of there is also AZURE_OPENAI_API_KEY variable used in my project, then I renamed it. But still this problem occurs. terminal also restarted, also tried /clear.

fry69 commented 1 month ago

This still looks very much like a configuration issue IMHO.

You can check what configuration parameters aider picks up from where if you start aider with --verbose.

delinecnlin commented 1 month ago

Thank you for your fast reply!! And sorry to bother again, but despite the .env parameter, I cannot find the differences:

Now I deleted the environment variables and set it in an ".env" file, put it in my home folder and also in the project folder.

C:\Users\lin\kidstory\kidstory_api>aider --model azure/gpt-4o-mini --verbose

OUTPUT FROM COMMAND LINE in WINDOWS:

Config files search order, if no --config:
  - C:\Users\lin\kidstory\kidstory_api\.aider.conf.yml
  - C:\Users\lin\.aider.conf.yml
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Loaded C:\Users\lin\.env
Loaded C:\Users\lin\kidstory\kidstory_api\.env
Too soon to check version: 10.4 hours
Command Line Args:   --model azure/gpt-4o-mini --verbose

Environment Variables:
  AIDER_CHAT_LANGUAGE:zh-cn

Defaults:
  --model-settings-file:.aider.model.settings.yml
  --model-metadata-file:.aider.model.metadata.json
  --env-file:        C:\Users\lin\kidstory\kidstory_api\.env
  --cache-keepalive-pings:0
  --map-refresh:     auto
  --map-multiplier-no-files:2
  --input-history-file:C:\Users\lin\kidstory\kidstory_api\.aider.input.history
  --chat-history-file:C:\Users\lin\kidstory\kidstory_api\.aider.chat.history.md
  --user-input-color:#00cc00
  --tool-error-color:#FF2222
  --tool-warning-color:#FFA500
  --assistant-output-color:#0088ff
  --code-theme:      default
  --aiderignore:     C:\Users\lin\kidstory\kidstory_api\.aiderignore
  --lint-cmd:        []
  --test-cmd:        []
  --encoding:        utf-8
  --voice-format:    wav
  --voice-language:  en

Option settings:
  - aiderignore: C:\Users\lin\kidstory\kidstory_api\.aiderignore
  - anthropic_api_key: None
  - apply: None
  - assistant_output_color: #0088ff
  - attribute_author: True
  - attribute_commit_message_author: False
  - attribute_commit_message_committer: False
  - attribute_committer: True
  - auto_commits: True
  - auto_lint: True
  - auto_test: False
  - cache_keepalive_pings: 0
  - cache_prompts: False
  - chat_history_file: C:\Users\lin\kidstory\kidstory_api\.aider.chat.history.md
  - chat_language: zh-cn
  - check_update: True
  - code_theme: default
  - commit: False
  - commit_prompt: None
  - completion_menu_bg_color: None
  - completion_menu_color: None
  - completion_menu_current_bg_color: None
  - completion_menu_current_color: None
  - config: None
  - dark_mode: False
  - dirty_commits: True
  - dry_run: False
  - edit_format: None
  - editor_edit_format: None
  - editor_model: None
  - encoding: utf-8
  - env_file: C:\Users\lin\kidstory\kidstory_api\.env
  - exit: False
  - file: None
  - files: []
  - git: True
  - gitignore: True
  - gui: False
  - input_history_file: C:\Users\lin\kidstory\kidstory_api\.aider.input.history
  - install_main_branch: False
  - just_check_update: False
  - light_mode: False
  - lint: False
  - lint_cmd: []
  - list_models: None
  - llm_history_file: None
  - map_multiplier_no_files: 2
  - map_refresh: auto
  - map_tokens: None
  - max_chat_history_tokens: None
  - message: None
  - message_file: None
  - model: azure/gpt-4o-mini
  - model_metadata_file: .aider.model.metadata.json
  - model_settings_file: .aider.model.settings.yml
  - openai_api_base: None
  - openai_api_deployment_id: None
  - openai_api_key: None
  - openai_api_type: None
  - openai_api_version: None
  - openai_organization_id: None
  - pretty: True
  - read: None
  - restore_chat_history: False
  - show_diffs: False
  - show_model_warnings: True
  - show_prompts: False
  - show_repo_map: False
  - stream: True
  - subtree_only: False
  - suggest_shell_commands: True
  - test: False
  - test_cmd: []
  - tool_error_color: #FF2222
  - tool_output_color: None
  - tool_warning_color: #FFA500
  - upgrade: False
  - user_input_color: #00cc00
  - verbose: True
  - verify_ssl: True
  - vim: False
  - voice_format: wav
  - voice_language: en
  - weak_model: None
  - yes: None

Checking imports for version 0.58.1 and executable C:\Users\lin\AppData\Local\Programs\Python\Python312\python.exe
Installs file: C:\Users\lin\.aider\installs.json
Installs file exists and loaded
Not first run, loading imports in background thread
No model settings files loaded
Searched for model settings files:
  - C:\Users\lin\.aider.model.settings.yml
  - C:\Users\lin\kidstory\kidstory_api\.aider.model.settings.yml
Model info:
{
    "max_tokens": 16384,
    "max_input_tokens": 128000,
    "max_output_tokens": 16384,
    "input_cost_per_token": 1.65e-07,
    "output_cost_per_token": 6.6e-07,
    "litellm_provider": "azure",
    "mode": "chat",
    "supports_function_calling": true,
    "supports_parallel_function_calling": true,
    "supports_vision": true
}
RepoMap initialized with map_mul_no_files: 2
Aider v0.58.1
Model: azure/gpt-4o-mini with diff edit format
Git repo: .git with 46 files
Repo-map: using 1024 tokens, auto refresh
Use /help <question> for help, run "aider --help" to see cmd line args
────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
> /ask hello

RepoMap initialized with map_mul_no_files: 2
Repo-map can't include C:\Users\lin\kidstory\kidstory_api\chapter_7.wav
Has it been deleted from the file system but not from git?
Repo-map: 0.7 k-tokens
Repo-map: 0.7 k-tokens

SYSTEM Act as an expert code analyst.
SYSTEM Answer questions about the supplied code.
SYSTEM Always reply to the user in the same language they are using.

USER I am working with you on code in a git repository.
USER Here are summaries of some files present in my git repo.
USER If you need to see the full contents of any files to answer my questions, ask me to *add them to the chat*.
USER
USER .gitignore
USER
USER __pycache__\app.cpython-312.pyc
USER
USER app.py
USER
USER app\__init__.py:
USER ⋮...
USER │def create_app():
USER ⋮...
USER
USER app\__pycache__\__init__.cpython-312.pyc
USER
USER app\__pycache__\app_instance.cpython-312.pyc
USER
USER app\__pycache__\config.cpython-312.pyc
USER
USER app\__pycache__\db.cpython-312.pyc
USER
USER app\__pycache__\hello.cpython-312.pyc
USER
USER app\__pycache__\image_service.cpython-312.pyc
USER
USER app\__pycache__\models.cpython-312.pyc
USER
USER app\__pycache__\routes.cpython-312.pyc
USER
USER app\__pycache__\speech.cpython-312.pyc
USER
USER app\__pycache__\story_service.cpython-312.pyc
USER
USER app\config.py
USER
USER app\db.py
USER
USER app\hello.py
USER
USER app\image_service.py:
USER ⋮...
USER │def generate_image(prompt):
USER ⋮...
USER
USER app\models.py:
USER ⋮...
USER │class Story(db.Model):
USER ⋮...
USER │class Chapter(db.Model):
USER ⋮...
USER
USER app\routes.py:
USER ⋮...
USER │@routes_bp.route('/fix_stories', methods=['POST'])
USER │def fix_stories():
USER ⋮...
USER
USER app\speech.py:
USER ⋮...
USER │def transcribe_audio(audio_data):
USER ⋮...
USER │def text_to_speech(text, output_file, voice='zh-CN-XiaoxiaoNeural'):
USER ⋮...
USER
USER app\story_service.py:
USER ⋮...
USER │def generate_story_title(preferences):
USER ⋮...
USER │def generate_chapter_content(preferences, image_file=None):
USER ⋮...
USER
USER chapter_7.wav
USER
USER instance\app.db
USER
USER migrations\README
USER
USER migrations\__pycache__\env.cpython-312.pyc
USER
USER migrations\alembic.ini
USER
USER migrations\env.py:
USER ⋮...
USER │def get_engine():
USER ⋮...
USER │def get_engine_url():
USER ⋮...
USER │def get_metadata():
USER ⋮...
USER │def run_migrations_offline():
USER ⋮...
USER │def run_migrations_online():
USER ⋮...
USER
USER migrations\script.py.mako
USER
USER migrations\versions\276f61324fb1_add_excerpt_to_story_model.py
USER
USER migrations\versions\56a629a00111_add_audio_url_field_to_chapter_model.py
USER
USER migrations\versions\__pycache__\276f61324fb1_add_excerpt_to_story_model.cpython-312.pyc
USER
USER migrations\versions\__pycache__\56a629a00111_add_audio_url_field_to_chapter_model.cpython-312.pyc
USER
USER migrations\versions\__pycache__\d23d6e45e5f1_.cpython-312.pyc
USER
USER migrations\versions\d23d6e45e5f1_.py
USER
USER requirements.txt
USER
USER reset_db.py
USER
USER scripts\fix_stories.py:
USER ⋮...
USER │def fix_stories():
USER ⋮...
USER
USER static\chapter_7.mp3
USER
USER static\chapter_7.wav
USER
USER templates\auth.html
USER
USER templates\fix_stories.html
USER
USER templates\index.html
USER
USER templates\recommendations.html
USER
USER templates\story.html
USER
USER templates\subscribe.html

ASSISTANT Ok, I won't try and edit those files without asking first.

USER I am not sharing the full contents of any files with you yet.

ASSISTANT Ok.

USER hello
Hello! How can I assist you today?

Tokens: 838 sent, 9 received. Cost: $0.00014 message, $0.00014 session.
RepoMap initialized with map_mul_no_files: 2

Everything seems to be good. THEN in the same folder in VSCode:

Config files search order, if no --config:
  - C:\Users\lin\kidstory\kidstory_api\.aider.conf.yml
  - C:\Users\lin\.aider.conf.yml
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
Loaded C:\Users\lin\.env
Loaded C:\Users\lin\kidstory\kidstory_api\.env
Too soon to check version: 10.5 hours
Command Line Args:   --model azure/gpt-4o-mini --verbose

Environment Variables:
  AIDER_CHAT_LANGUAGE:zh-cn

Defaults:
  --model-settings-file:.aider.model.settings.yml
  --model-metadata-file:.aider.model.metadata.json
  --env-file:        C:\Users\lin\kidstory\kidstory_api\.env
  --cache-keepalive-pings:0
  --map-refresh:     auto
  --map-multiplier-no-files:2
  --input-history-file:C:\Users\lin\kidstory\kidstory_api\.aider.input.history
  --chat-history-file:C:\Users\lin\kidstory\kidstory_api\.aider.chat.history.md
  --user-input-color:#00cc00
  --tool-error-color:#FF2222
  --tool-warning-color:#FFA500
  --assistant-output-color:#0088ff
  --code-theme:      default
  --aiderignore:     C:\Users\lin\kidstory\kidstory_api\.aiderignore
  --lint-cmd:        []
  --test-cmd:        []
  --encoding:        utf-8
  --voice-format:    wav
  --voice-language:  en

Option settings:
  - aiderignore: C:\Users\lin\kidstory\kidstory_api\.aiderignore
  - anthropic_api_key: None
  - apply: None
  - assistant_output_color: #0088ff
  - attribute_author: True
  - attribute_commit_message_author: False
  - attribute_commit_message_committer: False
  - attribute_committer: True
  - auto_commits: True
  - auto_lint: True
  - auto_test: False
  - cache_keepalive_pings: 0
  - cache_prompts: False
  - chat_history_file: C:\Users\lin\kidstory\kidstory_api\.aider.chat.history.md
  - chat_language: zh-cn
  - check_update: True
  - code_theme: default
  - commit: False
  - commit_prompt: None
  - completion_menu_bg_color: None
  - completion_menu_color: None
  - completion_menu_current_bg_color: None
  - completion_menu_current_color: None
  - config: None
  - dark_mode: False
  - dirty_commits: True
  - dry_run: False
  - edit_format: None
  - editor_edit_format: None
  - editor_model: None
  - encoding: utf-8
  - env_file: C:\Users\lin\kidstory\kidstory_api\.env
  - exit: False
  - file: None
  - files: []
  - git: True
  - gitignore: True
  - gui: False
  - input_history_file: C:\Users\lin\kidstory\kidstory_api\.aider.input.history
  - install_main_branch: False
  - just_check_update: False
  - light_mode: False
  - lint: False
  - lint_cmd: []
  - list_models: None
  - llm_history_file: None
  - map_multiplier_no_files: 2
  - map_refresh: auto
  - map_tokens: None
  - max_chat_history_tokens: None
  - message: None
  - message_file: None
  - model: azure/gpt-4o-mini
  - model_metadata_file: .aider.model.metadata.json
  - model_settings_file: .aider.model.settings.yml
  - openai_api_base: None
  - openai_api_deployment_id: None
  - openai_api_key: None
  - openai_api_type: None
  - openai_api_version: None
  - openai_organization_id: None
  - pretty: True
  - read: None
  - restore_chat_history: False
  - show_diffs: False
  - show_model_warnings: True
  - show_prompts: False
  - show_repo_map: False
  - stream: True
  - subtree_only: False
  - suggest_shell_commands: True
  - test: False
  - test_cmd: []
  - tool_error_color: #FF2222
  - tool_output_color: None
  - tool_warning_color: #FFA500
  - upgrade: False
  - user_input_color: #00cc00
  - verbose: True
  - verify_ssl: True
  - vim: False
  - voice_format: wav
  - voice_language: en
  - weak_model: None
  - yes: None

Checking imports for version 0.58.1 and executable C:\Users\lin\AppData\Local\Programs\Python\Python312\python.exe
Installs file: C:\Users\lin\.aider\installs.json
Installs file exists and loaded
Not first run, loading imports in background thread
No model settings files loaded
Searched for model settings files:
  - C:\Users\lin\.aider.model.settings.yml
  - C:\Users\lin\kidstory\kidstory_api\.aider.model.settings.yml
Model info:
{
    "max_tokens": 16384,
    "max_input_tokens": 128000,
    "max_output_tokens": 16384,
    "input_cost_per_token": 1.65e-07,
    "output_cost_per_token": 6.6e-07,
    "litellm_provider": "azure",
    "mode": "chat",
    "supports_function_calling": true,
    "supports_parallel_function_calling": true,
    "supports_vision": true
}
RepoMap initialized with map_mul_no_files: 2
Aider v0.58.1
Model: azure/gpt-4o-mini with diff edit format
Git repo: .git with 46 files
Repo-map: using 1024 tokens, auto refresh
VSCode terminal detected, pretty output has been disabled.
Use /help <question> for help, run "aider --help" to see cmd line args
───────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────────
> /ask hello

RepoMap initialized with map_mul_no_files: 2
Repo-map can't include C:\Users\lin\kidstory\kidstory_api\chapter_7.wav
Has it been deleted from the file system but not from git?
Repo-map: 0.7 k-tokens
Repo-map: 0.7 k-tokens

SYSTEM Act as an expert code analyst.
SYSTEM Answer questions about the supplied code.
SYSTEM Always reply to the user in the same language they are using.

USER I am working with you on code in a git repository.
USER Here are summaries of some files present in my git repo.
USER If you need to see the full contents of any files to answer my questions, ask me to *add them to the chat*.
USER
USER .gitignore
USER
USER __pycache__\app.cpython-312.pyc
USER
USER app.py
USER
USER app\__init__.py:
USER ⋮...
USER │def create_app():
USER ⋮...
USER
USER app\__pycache__\__init__.cpython-312.pyc
USER
USER app\__pycache__\app_instance.cpython-312.pyc
USER
USER app\__pycache__\config.cpython-312.pyc
USER
USER app\__pycache__\db.cpython-312.pyc
USER
USER app\__pycache__\hello.cpython-312.pyc
USER
USER app\__pycache__\image_service.cpython-312.pyc
USER
USER app\__pycache__\models.cpython-312.pyc
USER
USER app\__pycache__\routes.cpython-312.pyc
USER
USER app\__pycache__\speech.cpython-312.pyc
USER
USER app\__pycache__\story_service.cpython-312.pyc
USER
USER app\config.py
USER
USER app\db.py
USER
USER app\hello.py
USER
USER app\image_service.py:
USER ⋮...
USER │def generate_image(prompt):
USER ⋮...
USER
USER app\models.py:
USER ⋮...
USER │class Story(db.Model):
USER ⋮...
USER │class Chapter(db.Model):
USER ⋮...
USER
USER app\routes.py:
USER ⋮...
USER │@routes_bp.route('/fix_stories', methods=['POST'])
USER │def fix_stories():
USER ⋮...
USER
USER app\speech.py:
USER ⋮...
USER │def transcribe_audio(audio_data):
USER ⋮...
USER │def text_to_speech(text, output_file, voice='zh-CN-XiaoxiaoNeural'):
USER ⋮...
USER
USER app\story_service.py:
USER ⋮...
USER │def generate_story_title(preferences):
USER ⋮...
USER │def generate_chapter_content(preferences, image_file=None):
USER ⋮...
USER
USER chapter_7.wav
USER
USER instance\app.db
USER
USER migrations\README
USER
USER migrations\__pycache__\env.cpython-312.pyc
USER
USER migrations\alembic.ini
USER
USER migrations\env.py:
USER ⋮...
USER │def get_engine():
USER ⋮...
USER │def get_engine_url():
USER ⋮...
USER │def get_metadata():
USER ⋮...
USER │def run_migrations_offline():
USER ⋮...
USER │def run_migrations_online():
USER ⋮...
USER
USER migrations\script.py.mako
USER
USER migrations\versions\276f61324fb1_add_excerpt_to_story_model.py
USER
USER migrations\versions\56a629a00111_add_audio_url_field_to_chapter_model.py
USER
USER migrations\versions\__pycache__\276f61324fb1_add_excerpt_to_story_model.cpython-312.pyc
USER
USER migrations\versions\__pycache__\56a629a00111_add_audio_url_field_to_chapter_model.cpython-312.pyc
USER
USER migrations\versions\__pycache__\d23d6e45e5f1_.cpython-312.pyc
USER
USER migrations\versions\d23d6e45e5f1_.py
USER
USER requirements.txt
USER
USER reset_db.py
USER
USER scripts\fix_stories.py:
USER ⋮...
USER │def fix_stories():
USER ⋮...
USER
USER static\chapter_7.mp3
USER
USER static\chapter_7.wav
USER
USER templates\auth.html
USER
USER templates\fix_stories.html
USER
USER templates\index.html
USER
USER templates\recommendations.html
USER
USER templates\story.html
USER
USER templates\subscribe.html

ASSISTANT Ok, I won't try and edit those files without asking first.

USER I am not sharing the full contents of any files with you yet.

ASSISTANT Ok.

USER hello
Unexpected error: litellm.AuthenticationError: AzureException AuthenticationError - Error code: 401 - {'statusCode': 401, 'message': 
'Unauthorized. Access token is missing, invalid, audience is incorrect (https://cognitiveservices.azure.com), or have expired.'}
Traceback (most recent call last):
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\litellm\llms\AzureOpenAI\azure.py", line 674, in completion     
    return self.streaming(
           ^^^^^^^^^^^^^^^
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\litellm\llms\AzureOpenAI\azure.py", line 945, in streaming      
    headers, response = self.make_sync_azure_openai_chat_completion_request(
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\litellm\llms\AzureOpenAI\azure.py", line 550, in
make_sync_azure_openai_chat_completion_request
    raise e
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\litellm\llms\AzureOpenAI\azure.py", line 542, in
make_sync_azure_openai_chat_completion_request
    raw_response = azure_client.chat.completions.with_raw_response.create(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\openai\_legacy_response.py", line 353, in wrapped
    return cast(LegacyAPIResponse[R], func(*args, **kwargs))
                                      ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\openai\_utils\_utils.py", line 274, in wrapper
    return func(*args, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\openai\resources\chat\completions.py", line 704, in create      
    return self._post(
           ^^^^^^^^^^^
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\openai\_base_client.py", line 1268, in post
    return cast(ResponseT, self.request(cast_to, opts, stream=stream, stream_cls=stream_cls))
                           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\openai\_base_client.py", line 945, in request
    return self._request(
           ^^^^^^^^^^^^^^
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\openai\_base_client.py", line 1049, in _request
    raise self._make_status_error_from_response(err.response) from None
openai.AuthenticationError: Error code: 401 - {'statusCode': 401, 'message': 'Unauthorized. Access token is missing, invalid, audience is      
incorrect (https://cognitiveservices.azure.com), or have expired.'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\litellm\main.py", line 1064, in completion
    response = azure_chat_completions.completion(
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\litellm\llms\AzureOpenAI\azure.py", line 770, in completion     
    raise AzureOpenAIError(
litellm.llms.AzureOpenAI.azure.AzureOpenAIError: Error code: 401 - {'statusCode': 401, 'message': 'Unauthorized. Access token is missing,      
invalid, audience is incorrect (https://cognitiveservices.azure.com), or have expired.'}

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\aider\coders\base_coder.py", line 1129, in send_message
    yield from self.send(messages, functions=self.functions)
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\aider\coders\base_coder.py", line 1410, in send
    hash_object, completion = send_completion(
                              ^^^^^^^^^^^^^^^^
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\aider\sendchat.py", line 83, in send_completion
    res = litellm.completion(**kwargs)
          ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\litellm\utils.py", line 1086, in wrapper
    raise e
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\litellm\utils.py", line 974, in wrapper
    result = original_function(*args, **kwargs)
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\litellm\main.py", line 2847, in completion
    raise exception_type(
          ^^^^^^^^^^^^^^^
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\litellm\utils.py", line 8194, in exception_type
    raise e
  File "C:\Users\lin\AppData\Local\Programs\Python\Python312\Lib\site-packages\litellm\utils.py", line 7981, in exception_type
    raise AuthenticationError(
litellm.exceptions.AuthenticationError: litellm.AuthenticationError: AzureException AuthenticationError - Error code: 401 - {'statusCode': 401,
'message': 'Unauthorized. Access token is missing, invalid, audience is incorrect (https://cognitiveservices.azure.com), or have expired.'}    

RepoMap initialized with map_mul_no_files: 2
fry69 commented 1 month ago

I am no expert in Windows and its terminals, but my guess is that you use a different terminal environment in VSCode than outside VSCode, which probably affects e.g. set environment variables.