AlexxIT/go2rtc · error

wrong content type

Error message

wrong content type

What it means

RTSP server Accept guard: an ANNOUNCE request arrived whose Content-Type is not 'application/sdp'. The SDP describing the tracks to record cannot be trusted from a non-SDP body, so the announce is rejected before c.SDP is set.

Solutions

  1. Fix the publishing client to send Content-Type: application/sdp with ANNOUNCE
  2. Check for proxy/Middleware stripping or rewriting the header
  3. Verify the client speaks RTSP push, not RTMP/HTTP put
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at pkg/rtsp/server.go:83 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of AlexxIT/go2rtc@c245815e75 (2026-09-07). Data as JSON: /api/errors/32c01a2a9754c2cc. Report an issue: GitHub.

Appendix: source

Thrown at pkg/rtsp/server.go:83

		}

		// Receiver: OPTIONS > DESCRIBE > SETUP... > PLAY > TEARDOWN
		// Sender: OPTIONS > ANNOUNCE > SETUP... > RECORD > TEARDOWN
		switch req.Method {
		case MethodOptions:
			res := &tcp.Response{
				Header: map[string][]string{
					"Public": {"OPTIONS, SETUP, TEARDOWN, DESCRIBE, PLAY, PAUSE, ANNOUNCE, RECORD"},
				},
				Request: req,
			}
			if err = c.WriteResponse(res); err != nil {
				return err
			}

		case MethodAnnounce:
			if req.Header.Get("Content-Type") != "application/sdp" {
				return errors.New("wrong content type")
			}

			c.SDP = string(req.Body) // for info

			c.Medias, err = UnmarshalSDP(req.Body)
			if err != nil {
				return err
			}

			// TODO: fix someday...
			for i, media := range c.Medias {
				track := core.NewReceiver(media, media.Codecs[0])
				track.ID = byte(i * 2)
				c.Receivers = append(c.Receivers, track)
			}

			c.mode = core.ModePassiveProducer
			c.Fire(MethodAnnounce)

View on GitHub (pinned to c245815e75)