router-for-me/CLIProxyAPI · error

create downstream audio track: %w

Error message

create downstream audio track: %w

What it means

Thrown when webrtc.NewTrackLocalStaticRTP(opusCodec, "audio", "codex-live") fails for the downstream (client-facing) track. With a static capability this constructor essentially cannot fail in current pion v4 — it validates the codec capability (must have MimeType, ClockRate > 0). Failure means the opusCodec constant is malformed or a pion version changed validation rules.

Source

Thrown at internal/client/codex/live/media.go:332

	}
	session.bridge = newDataChannelBridge(session.done, func(err error) {
		session.fail("data_channel_failed", err)
	})
	session.installStateHandlers()
	log.WithFields(session.logFields("session")).Info("codex live WebRTC media session created")

	if errRemote := downstream.SetRemoteDescription(webrtc.SessionDescription{
		Type: webrtc.SDPTypeOffer,
		SDP:  clientOffer,
	}); errRemote != nil {
		_ = session.Close()
		return nil, "", fmt.Errorf("set downstream WebRTC offer: %w", errRemote)
	}

	toDesktop, errTrack := webrtc.NewTrackLocalStaticRTP(opusCodec, "audio", "codex-live")
	if errTrack != nil {
		_ = session.Close()
		return nil, "", fmt.Errorf("create downstream audio track: %w", errTrack)
	}
	downstreamSender, errTrack := downstream.AddTrack(toDesktop)
	if errTrack != nil {
		_ = session.Close()
		return nil, "", fmt.Errorf("add downstream audio track: %w", errTrack)
	}
	go drainRTCP("downstream", downstreamSender, session.done)

	toOpenAI, errTrack := webrtc.NewTrackLocalStaticRTP(opusCodec, "audio", "codex-live")
	if errTrack != nil {
		_ = session.Close()
		return nil, "", fmt.Errorf("create upstream audio track: %w", errTrack)
	}
	upstreamSender, errTrack := upstream.AddTrack(toOpenAI)
	if errTrack != nil {
		_ = session.Close()
		return nil, "", fmt.Errorf("add upstream audio track: %w", errTrack)
	}

View on GitHub (pinned to 78f0c4079e)

Solutions

  1. Restore opusCodec to MimeTypeOpus / ClockRate 48000 / Channels 2
  2. Pin/align pion/webrtc v4 to a tested version after upgrades
  3. Treat as a code defect — no runtime config influences this path
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: A pion/webrtc upgrade that tightens TrackLocalStaticRTP validation, or a code change to the opusCodec variable (e.g. zero ClockRate or empty MimeType).

Common situations: Practically unreachable with the shipped constants; appears only after hand-editing opusCodec or a major pion version bump.

Related errors


AI-assisted analysis of router-for-me/CLIProxyAPI@78f0c4079e (2026-08-15). Data as JSON: /api/errors/08a202bfc4c20e44. Report an issue: GitHub.