René's URL Explorer Experiment


Title: LiteLLMIntegration stores a non-JSON-serializable Span in request metadata, breaking outbound LLM requests · Issue #6596 · getsentry/sentry-python · GitHub

Open Graph Title: LiteLLMIntegration stores a non-JSON-serializable Span in request metadata, breaking outbound LLM requests · Issue #6596 · getsentry/sentry-python

X Title: LiteLLMIntegration stores a non-JSON-serializable Span in request metadata, breaking outbound LLM requests · Issue #6596 · getsentry/sentry-python

Description: How do you use Sentry? Sentry SaaS (sentry.io) Version sentry-sdk 2.52.0 (also present on current master); litellm 1.81.9; Python 3.13 Steps to Reproduce With the LiteLLM integration enabled, any call that passes caller metadata crashes ...

Open Graph Description: How do you use Sentry? Sentry SaaS (sentry.io) Version sentry-sdk 2.52.0 (also present on current master); litellm 1.81.9; Python 3.13 Steps to Reproduce With the LiteLLM integration enabled, any c...

X Description: How do you use Sentry? Sentry SaaS (sentry.io) Version sentry-sdk 2.52.0 (also present on current master); litellm 1.81.9; Python 3.13 Steps to Reproduce With the LiteLLM integration enabled, any c...

Opengraph URL: https://github.com/getsentry/sentry-python/issues/6596

X: @github

direct link

Domain: github.com


Hey, it has json ld scripts:
{"@context":"https://schema.org","@type":"DiscussionForumPosting","headline":"LiteLLMIntegration stores a non-JSON-serializable Span in request metadata, breaking outbound LLM requests","articleBody":"### How do you use Sentry?\n\nSentry SaaS (sentry.io)\n\n### Version\n\n`sentry-sdk` 2.52.0 (also present on current `master`); `litellm` 1.81.9; Python 3.13\n\n### Steps to Reproduce\n\nWith the LiteLLM integration enabled, any call that passes caller `metadata` crashes during request serialization:\n\n```python\nimport asyncio, litellm, sentry_sdk\nfrom sentry_sdk.integrations.litellm import LiteLLMIntegration\n\nsentry_sdk.init(\n    dsn=\"\u003cyour-dsn\u003e\", traces_sample_rate=1.0,\n    send_default_pii=True, integrations=[LiteLLMIntegration()],\n)\n\nasync def main():\n    await litellm.anthropic.messages.acreate(\n        model=\"anthropic/claude-3-5-sonnet-latest\",\n        messages=[{\"role\": \"user\", \"content\": \"hi\"}],\n        max_tokens=16, stream=True, api_key=\"sk-ant-...\",\n        metadata={\"user_id\": \"my-org\"},   # Anthropic abuse-isolation id\n    )\n\nasyncio.run(main())\n```\n\n**Root cause:** `_input_callback` stores the live span via `_get_metadata_dict(kwargs)[\"_sentry_span\"] = span` (`sentry_sdk/integrations/litellm.py`). litellm's Anthropic `/v1/messages` passthrough forwards `metadata` into the request body, so the live `Span` lands at `request_body['metadata']['_sentry_span']` and `json.dumps(request_body)` fails — before the request is sent.\n\n### Expected Result\n\nEnabling the integration must not make outbound provider requests unserializable. The integration's bookkeeping span should be stashed off-band (e.g. a `WeakKeyDictionary` keyed on the logging object) rather than written into the caller's request `metadata` dict, which several providers (Anthropic here) forward into the wire payload.\n\n### Actual Result\n\n```\nTypeError: Object of type Span is not JSON serializable\n```\n\n(a `Transaction` when there is no active parent span). Separately, with `send_default_pii=True` + `include_prompts=True` (the default), that span's `gen_ai.request.messages` holds the **verbatim prompt** — so any sink that serializes this span object can leak prompt content.\n\n---\n\nRelated (defense-in-depth, downstream): litellm forwards/serializes this injected metadata into the provider body. Companion issue filed at BerriAI/litellm — see comment below. litellm has stripped such span objects in other logging paths: BerriAI/litellm#15728, BerriAI/litellm#12354.\n","author":{"url":"https://github.com/jgreer013","@type":"Person","name":"jgreer013"},"datePublished":"2026-06-17T16:41:36.000Z","interactionStatistic":{"@type":"InteractionCounter","interactionType":"https://schema.org/CommentAction","userInteractionCount":2},"url":"https://github.com/6596/sentry-python/issues/6596"}

route-pattern/_view_fragments/issues/show/:user_id/:repository/:id/issue_layout(.:format)
route-controllervoltron_issues_fragments
route-actionissue_layout
fetch-noncev2:9334b812-f26f-d7b1-db28-fe67c7e6aaff
current-catalog-service-hash81bb79d38c15960b92d99bca9288a9108c7a47b18f2423d0f6438c5b7bcd2114
request-idA454:633B1:494BB2:682D84:6A4E6F43
html-safe-nonceafec865bdf5525679c165eb74c034e923b8be2c8bcae57ff5ee57adc72b468d0
visitor-payloadeyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiJBNDU0OjYzM0IxOjQ5NEJCMjo2ODJEODQ6NkE0RTZGNDMiLCJ2aXNpdG9yX2lkIjoiNDEyOTA2ODkyODkzNTU1NDg4MyIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9
visitor-hmacdaf0dbedb77e28b847c711b00b560af229824f1daadf2f3a3fc4b3e5985c08ab
hovercard-subject-tagissue:4685241714
github-keyboard-shortcutsrepository,issues,copilot
google-site-verificationApib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I
octolytics-urlhttps://collector.github.com/github/collect
analytics-location///voltron/issues_fragments/issue_layout
fb:app_id1401488693436528
apple-itunes-appapp-id=1477376905, app-argument=https://github.com/_view_fragments/issues/show/getsentry/sentry-python/6596/issue_layout
twitter:imagehttps://opengraph.githubassets.com/fbb23c05d75e642e59b4cdbc1a69ced37484756a162f2c7f209e320f44559e4e/getsentry/sentry-python/issues/6596
twitter:cardsummary_large_image
og:imagehttps://opengraph.githubassets.com/fbb23c05d75e642e59b4cdbc1a69ced37484756a162f2c7f209e320f44559e4e/getsentry/sentry-python/issues/6596
og:image:altHow do you use Sentry? Sentry SaaS (sentry.io) Version sentry-sdk 2.52.0 (also present on current master); litellm 1.81.9; Python 3.13 Steps to Reproduce With the LiteLLM integration enabled, any c...
og:image:width1200
og:image:height600
og:site_nameGitHub
og:typeobject
og:author:usernamejgreer013
hostnamegithub.com
expected-hostnamegithub.com
None41b6ab3ba6d20a71766ac245b5a4a94c6fc672a9cd4da7d44c1b33ab8bf6a21c
turbo-cache-controlno-preview
go-importgithub.com/getsentry/sentry-python git https://github.com/getsentry/sentry-python.git
octolytics-dimension-user_id1396951
octolytics-dimension-user_logingetsentry
octolytics-dimension-repository_id137814779
octolytics-dimension-repository_nwogetsentry/sentry-python
octolytics-dimension-repository_publictrue
octolytics-dimension-repository_is_forkfalse
octolytics-dimension-repository_network_root_id137814779
octolytics-dimension-repository_network_root_nwogetsentry/sentry-python
turbo-body-classeslogged-out env-production page-responsive
disable-turbofalse
browser-stats-urlhttps://api.github.com/_private/browser/stats
browser-errors-urlhttps://api.github.com/_private/browser/errors
releasee6a744804e8e70f97b4d5a18a94dcc63db22f97a
ui-targetfull
theme-color#1e2327
color-schemelight dark

Links:

Skip to contenthttps://github.com/getsentry/sentry-python/issues/6596#start-of-content
https://github.com/
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-python%2Fissues%2F6596
GitHub CopilotWrite better code with AIhttps://github.com/features/copilot
GitHub Copilot appDirect agents from issue to mergehttps://github.com/features/ai/github-app
MCP RegistryNewIntegrate external toolshttps://github.com/mcp
ActionsAutomate any workflowhttps://github.com/features/actions
CodespacesInstant dev environmentshttps://github.com/features/codespaces
IssuesPlan and track workhttps://github.com/features/issues
Code ReviewManage code changeshttps://github.com/features/code-review
GitHub Advanced SecurityFind and fix vulnerabilitieshttps://github.com/security/advanced-security
Code securitySecure your code as you buildhttps://github.com/security/advanced-security/code-security
Secret protectionStop leaks before they starthttps://github.com/security/advanced-security/secret-protection
Why GitHubhttps://github.com/why-github
Documentationhttps://docs.github.com
Bloghttps://github.blog
Changeloghttps://github.blog/changelog
Marketplacehttps://github.com/marketplace
View all featureshttps://github.com/features
Enterpriseshttps://github.com/enterprise
Small and medium teamshttps://github.com/team
Startupshttps://github.com/enterprise/startups
Nonprofitshttps://github.com/solutions/industry/nonprofits
App Modernizationhttps://github.com/solutions/use-case/app-modernization
DevSecOpshttps://github.com/solutions/use-case/devsecops
DevOpshttps://github.com/solutions/use-case/devops
CI/CDhttps://github.com/solutions/use-case/ci-cd
View all use caseshttps://github.com/solutions/use-case
Healthcarehttps://github.com/solutions/industry/healthcare
Financial serviceshttps://github.com/solutions/industry/financial-services
Manufacturinghttps://github.com/solutions/industry/manufacturing
Governmenthttps://github.com/solutions/industry/government
View all industrieshttps://github.com/solutions/industry
View all solutionshttps://github.com/solutions
AIhttps://github.com/resources/articles?topic=ai
Software Developmenthttps://github.com/resources/articles?topic=software-development
DevOpshttps://github.com/resources/articles?topic=devops
Securityhttps://github.com/resources/articles?topic=security
View all topicshttps://github.com/resources/articles
Customer storieshttps://github.com/customer-stories
Events & webinarshttps://github.com/resources/events
Ebooks & reportshttps://github.com/resources/whitepapers
Business insightshttps://github.com/solutions/executive-insights
GitHub Skillshttps://skills.github.com
Documentationhttps://docs.github.com
Customer supporthttps://support.github.com
Community forumhttps://github.com/orgs/community/discussions
Trust centerhttps://github.com/trust-center
Partnershttps://github.com/partners
View all resourceshttps://github.com/resources
GitHub SponsorsFund open source developershttps://github.com/open-source/sponsors
Security Labhttps://securitylab.github.com
Maintainer Communityhttps://maintainers.github.com
Acceleratorhttps://github.com/open-source/accelerator
GitHub Starshttps://stars.github.com
Archive Programhttps://archiveprogram.github.com
Topicshttps://github.com/topics
Trendinghttps://github.com/trending
Collectionshttps://github.com/collections
Enterprise platformAI-powered developer platformhttps://github.com/enterprise
GitHub Advanced SecurityEnterprise-grade security featureshttps://github.com/security/advanced-security
Copilot for BusinessEnterprise-grade AI featureshttps://github.com/features/copilot/copilot-business
Premium SupportEnterprise-grade 24/7 supporthttps://github.com/enterprise/premium-support
Pricinghttps://github.com/pricing
Search syntax tipshttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
documentationhttps://docs.github.com/search-github/github-code-search/understanding-github-code-search-syntax
Sign in https://github.com/login?return_to=https%3A%2F%2Fgithub.com%2Fgetsentry%2Fsentry-python%2Fissues%2F6596
Sign up https://github.com/signup?ref_cta=Sign+up&ref_loc=header+logged+out&ref_page=%2F%3Cuser-name%3E%2F%3Crepo-name%3E%2Fvoltron%2Fissues_fragments%2Fissue_layout&source=header-repo&source_repo=getsentry%2Fsentry-python
Reloadhttps://github.com/getsentry/sentry-python/issues/6596
Reloadhttps://github.com/getsentry/sentry-python/issues/6596
Reloadhttps://github.com/getsentry/sentry-python/issues/6596
Please reload this pagehttps://github.com/getsentry/sentry-python/issues/6596
getsentry https://github.com/getsentry
sentry-pythonhttps://github.com/getsentry/sentry-python
Notifications https://github.com/login?return_to=%2Fgetsentry%2Fsentry-python
Fork 638 https://github.com/login?return_to=%2Fgetsentry%2Fsentry-python
Star 2.2k https://github.com/login?return_to=%2Fgetsentry%2Fsentry-python
Code https://github.com/getsentry/sentry-python
Issues 365 https://github.com/getsentry/sentry-python/issues
Pull requests 56 https://github.com/getsentry/sentry-python/pulls
Discussions https://github.com/getsentry/sentry-python/discussions
Actions https://github.com/getsentry/sentry-python/actions
Security and quality 2 https://github.com/getsentry/sentry-python/security
Insights https://github.com/getsentry/sentry-python/pulse
Code https://github.com/getsentry/sentry-python
Issues https://github.com/getsentry/sentry-python/issues
Pull requests https://github.com/getsentry/sentry-python/pulls
Discussions https://github.com/getsentry/sentry-python/discussions
Actions https://github.com/getsentry/sentry-python/actions
Security and quality https://github.com/getsentry/sentry-python/security
Insights https://github.com/getsentry/sentry-python/pulse
#6598https://github.com/getsentry/sentry-python/pull/6598
LiteLLMIntegration stores a non-JSON-serializable Span in request metadata, breaking outbound LLM requestshttps://github.com/getsentry/sentry-python/issues/6596#top
#6598https://github.com/getsentry/sentry-python/pull/6598
https://github.com/alexander-alderman-webb
Bughttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Bug%22
PythonSDKhttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Python%22
Spanshttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Spans%22
https://github.com/jgreer013
jgreer013https://github.com/jgreer013
on Jun 17, 2026https://github.com/getsentry/sentry-python/issues/6596#issue-4685241714
BerriAI/litellm#15728https://github.com/BerriAI/litellm/pull/15728
BerriAI/litellm#12354https://github.com/BerriAI/litellm/issues/12354
alexander-alderman-webbhttps://github.com/alexander-alderman-webb
Bughttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Bug%22
PythonSDKhttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Python%22
Spanshttps://github.com/getsentry/sentry-python/issues?q=state%3Aopen%20label%3A%22Spans%22
GitHub Issues with 👀 3https://github.com/orgs/getsentry/projects/227
https://github.com
Termshttps://docs.github.com/site-policy/github-terms/github-terms-of-service
Privacyhttps://docs.github.com/site-policy/privacy-policies/github-privacy-statement
Securityhttps://github.com/security
Statushttps://www.githubstatus.com/
Communityhttps://github.community/
Docshttps://docs.github.com/
Contacthttps://support.github.com?tags=dotcom-footer

Viewport: width=device-width


URLs of crawlers that visited me.