From 2fb43912322593ad193e5ea79a09d53118890048 Mon Sep 17 00:00:00 2001 From: ryan Date: Sun, 20 Sep 2026 01:44:57 +0000 Subject: [PATCH] fix(errors): strip only the notice separator from client messages Co-Authored-By: Devin AI <158243242+devin-ai-integration[bot]@users.noreply.github.com> --- litellm/litellm_core_utils/bug_report.py | 5 ++++- tests/test_litellm/litellm_core_utils/test_bug_report.py | 2 +- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/litellm/litellm_core_utils/bug_report.py b/litellm/litellm_core_utils/bug_report.py index ba1a78e8c07..76d758c18d3 100644 --- a/litellm/litellm_core_utils/bug_report.py +++ b/litellm/litellm_core_utils/bug_report.py @@ -153,7 +153,10 @@ def bug_report_issue_url(report: BugReport) -> str: def strip_bug_report_notice(message: str) -> str: index: Final = message.find(NOTICE_PREFIX) - return message if index == -1 else message[:index].rstrip() + if index == -1: + return message + head: Final = message[:index] + return head.removesuffix("\n") def bug_report_notice(report: BugReport) -> str: diff --git a/tests/test_litellm/litellm_core_utils/test_bug_report.py b/tests/test_litellm/litellm_core_utils/test_bug_report.py index bf4fe92a934..7746e5688d3 100644 --- a/tests/test_litellm/litellm_core_utils/test_bug_report.py +++ b/tests/test_litellm/litellm_core_utils/test_bug_report.py @@ -100,5 +100,5 @@ def test_strip_bug_report_notice(): report = build_bug_report(RuntimeError("boom"), surface="sdk") notice = bug_report_notice(report) - assert strip_bug_report_notice(f"boom\n{notice}") == "boom" + assert strip_bug_report_notice(f"boom\n\n{notice}") == "boom\n" assert strip_bug_report_notice("boom") == "boom"