iflytek/astron-agent · error · TypeError

Legacy mandatory/optional constraints not supported.

Error message

Legacy mandatory/optional constraints not supported.

What it means

Thrown by the SDK's createOffer implementation when legacy-style mandatory/optional constraints are passed instead of modern RTCOfferOptions. The generic guard rejects old getUserMedia-style constraint objects passed as offer options in the avatar player's fallback PeerConnection.

Solutions

  1. Pass modern RTCOfferOptions (e.g. {offerToReceiveAudio}) instead of {mandatory:..., optional:...}
  2. Migrate the SDK/caller code to the standard constraints API
  3. Call createOffer with no arguments if default behavior is acceptable
Defensive patterns

Strategy: validation

When it happens

Trigger: Thrown at console/frontend/src/utils/avatar-sdk-web_3.1.2.1002/webrtc-player--YuOiwFd.js:3578 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of iflytek/astron-agent@5e758547a8 (2026-09-12). Data as JSON: /api/errors/447ee4614ebb6946. Report an issue: GitHub.

Appendix: source

Thrown at console/frontend/src/utils/avatar-sdk-web_3.1.2.1002/webrtc-player--YuOiwFd.js:3578

                this._dispatchEvent('connectionstatechange', r);
              }
            }),
            (p.prototype.createOffer = function () {
              var r = this;
              if (r._isClosed)
                return Promise.reject(
                  c('InvalidStateError', 'Can not call createOffer after close')
                );
              var a = r.transceivers.filter(function (e) {
                  return 'audio' === e.kind;
                }).length,
                o = r.transceivers.filter(function (e) {
                  return 'video' === e.kind;
                }).length,
                s = arguments[0];
              if (s) {
                if (s.mandatory || s.optional)
                  throw new TypeError(
                    'Legacy mandatory/optional constraints not supported.'
                  );
                (void 0 !== s.offerToReceiveAudio &&
                  (a =
                    !0 === s.offerToReceiveAudio
                      ? 1
                      : !1 === s.offerToReceiveAudio
                        ? 0
                        : s.offerToReceiveAudio),
                  void 0 !== s.offerToReceiveVideo &&
                    (o =
                      !0 === s.offerToReceiveVideo
                        ? 1
                        : !1 === s.offerToReceiveVideo
                          ? 0
                          : s.offerToReceiveVideo));
              }
              for (

View on GitHub (pinned to 5e758547a8)