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"