Skip to content

[receiver/otlpreceiver] errorHandler returns 500 when Content-Type is unsupported or malformed #15995

Closed

Description

@boqu

Component(s)

No response

Describe the issue you're reporting

Describe the bug

errorHandler in receiver/otlpreceiver/otlphttp.go encodes the error Status using the
request's Content-Type. When that type is neither protobuf nor JSON — unsupported (text/plain) or malformed (application/) — it drops the original status code and writes 500 {"code": 13, "message": "failed to marshal error message"}. Client errors such as a 401 from an auth extension are reported as server faults, so clients retry requests that can never succeed.

Steps to reproduce

Collector with the OTLP receiver and an authenticator on the HTTP endpoint:

  curl -i -X POST localhost:4318/v1/traces \
    -H 'Content-Type: text/plain' \
    -H 'Authorization: Bearer auth_thisisnotarealtoken' \
    --data-binary ''

What did you expect to see?

401 Unauthorized, status message encoded as JSON.

What did you see instead?

500 Internal Server Error with {"code": 13, "message": "failed to marshal error message"}.

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Activity

  1. boqu commented on Sep 21, 2026

    @boqu
    ContributorAuthor

    The PR to fix the issue.

  2. added a commit that references this issue on Sep 26, 2026
    53ca64f
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Fields

    Priority

    None yet

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions