Skip to content

fix: softFail noisy 'Not Acceptable' Accept-header errors from SDK#837

Merged
MQ37 merged 1 commit into
masterfrom
fix/softfail-not-acceptable-accept-header
May 13, 2026
Merged

fix: softFail noisy 'Not Acceptable' Accept-header errors from SDK#837
MQ37 merged 1 commit into
masterfrom
fix/softfail-not-acceptable-accept-header

Conversation

@MQ37
Copy link
Copy Markdown
Contributor

@MQ37 MQ37 commented May 13, 2026

Context

WebStandardStreamableHTTPServerTransport throws Not Acceptable: Client must accept ... from both handlePostRequest and handleGetRequest when the client's Accept header is missing one of the required MIME types (application/json, text/event-stream). The SDK already responds HTTP 406 to the caller, then forwards the error to onerror — where we currently log it as [MCP Error] and trip Mezmo alerts. Same class of client-misconfiguration noise we already soft-fail via #787 / #795.

Solution

Add the SDK error prefix Not Acceptable: Client must accept to the existing soft-fail filter in setupErrorHandling(). The prefix covers both variants the SDK emits (GET-path "must accept text/event-stream" and POST-path "must accept both application/json and text/event-stream").

Worth your attention

  • Refactored the regex into an Array.join('|') builder — the previous one-liner was already brushing the 160-char max-len cap; a 5th alternation would break it. Each pattern now lives on its own line aligned with the comment block above.
  • No tests added — follows the precedent from fix: Handle SSE controller closed state in error logging #795 ("Drop the SSE softFail unit test"), the filter is a string-match guard with no behavioral branching worth a unit test.

WebStandardStreamableHTTPServerTransport.handlePost/GetRequest throws when
the client's Accept header is missing one of the required MIME types
(application/json and/or text/event-stream). The SDK forwards it to
onerror, but the transport has already responded with HTTP 406 \u2014 nothing
for us to do server-side. This is pure client misconfiguration noise,
so route it through the same softFail branch as the other known
client-disconnect patterns to avoid Mezmo error alerts.

Refactor the regex into an array \u00b7 join('|') so the line stays under the
160-char max-len cap as patterns are added.
@MQ37 MQ37 requested a review from jirispilka May 13, 2026 14:42
@github-actions github-actions Bot added the t-ai Issues owned by the AI team. label May 13, 2026
@MQ37 MQ37 merged commit 8e00778 into master May 13, 2026
11 checks passed
@MQ37 MQ37 deleted the fix/softfail-not-acceptable-accept-header branch May 13, 2026 14:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

t-ai Issues owned by the AI team.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants