Skip to content

[Bug fix]: aiohttp fixes for transfer encoding error on aiohttp transport - #11561

Merged
ishaan-jaff merged 2 commits into
mainfrom
litellm_fixes_transfer_encoding_stream
Jun 9, 2025
Merged

[Bug fix]: aiohttp fixes for transfer encoding error on aiohttp transport#11561
ishaan-jaff merged 2 commits into
mainfrom
litellm_fixes_transfer_encoding_stream

Conversation

@ishaan-jaff

@ishaan-jaff ishaan-jaff commented Jun 9, 2025

Copy link
Copy Markdown
Contributor

[Bug fix]: aiohttp fixes for transfer encoding error on aiohttp transport

This PR fixes transfer-encoding error handling in the aiohttp transport and adds comprehensive async tests for various exception scenarios.

Relevant issues

Pre-Submission checklist

Please complete all items before asking a LiteLLM maintainer to review your PR

  • I have Added testing in the tests/litellm/ directory, Adding at least 1 test is a hard requirement - see details
  • I have added a screenshot of my new test passing locally
  • My PR passes all unit tests on make test-unit
  • My PR's scope is as isolated as possible, it only solves 1 specific problem

Type

🐛 Bug Fix
✅ Test

Changes

@vercel

vercel Bot commented Jun 9, 2025

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
litellm ✅ Ready (Inspect) Visit Preview 💬 Add feedback Jun 9, 2025 11:15pm

@ishaan-jaff
ishaan-jaff requested a review from Copilot June 9, 2025 22:07

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR fixes transfer-encoding error handling in the aiohttp transport and adds comprehensive async tests for various exception scenarios.

  • Removed a redundant map_aiohttp_exceptions wrapper around chunk iteration in AiohttpResponseStream.__aiter__.
  • Added tests covering normal flow, transfer-encoding errors, ClientPayloadError handling, unknown exception mapping, and timeout mapping.

Reviewed Changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.

File Description
tests/test_litellm/llms/custom_httpx/test_aiohttp_transport.py Added async tests for AiohttpResponseStream behavior and exception mapping
litellm/llms/custom_httpx/aiohttp_transport.py Removed incorrect use of map_aiohttp_exceptions in __aiter__
Comments suppressed due to low confidence (1)

tests/test_litellm/llms/custom_httpx/test_aiohttp_transport.py:1

  • Test files are placed under 'tests/test_litellm/...', but the project uses 'tests/litellm/...'; move this file to the correct directory so pytest can discover it.
import os

@pytest.mark.asyncio
async def test_transfer_encoding_error_no_httpx_read_error():
"""Test that TransferEncodingError doesn't get converted to httpx.ReadError"""
import logging

Copilot AI Jun 9, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Remove unused import 'logging' since it's not used in this test.

Suggested change
import logging

Copilot uses AI. Check for mistakes.
Comment thread tests/test_litellm/llms/custom_httpx/test_aiohttp_transport.py Outdated
Comment thread tests/test_litellm/llms/custom_httpx/test_aiohttp_transport.py
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
@ishaan-jaff
ishaan-jaff merged commit 9b87fde into main Jun 9, 2025
@ishaan-berri
ishaan-berri deleted the litellm_fixes_transfer_encoding_stream branch March 26, 2026 21:53
fzowl pushed a commit to fzowl/litellm that referenced this pull request Jun 24, 2026
…port (BerriAI#11561)

* fix: fixes for transfer encoding error on aiohttp transport

* Update tests/test_litellm/llms/custom_httpx/test_aiohttp_transport.py

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>

---------

Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants