{"record":{"id":"e7956cb2b13a0694","repo":"iflytek/astron-agent","slug":"invalid-rid-value-provided-xrtc-player-bjtnvhg9","errorCode":null,"errorMessage":"Invalid RID value provided.","messagePattern":"Invalid RID value provided\\.","errorType":"exception","errorClass":"TypeError","httpStatus":null,"severity":"error","filePath":"console/frontend/src/utils/avatar-sdk-web_3.1.2.1002/xrtc-player-BJTnVhG9.js","lineNumber":19761,"sourceCode":"        t.track && e.getTracks().includes(t.track) && this.removeTrack(t);\n      });\n    });\n}\nfunction cr(e) {\n  e.DataChannel && !e.RTCDataChannel && (e.RTCDataChannel = e.DataChannel);\n}\nfunction ur(e) {\n  if ('object' != typeof e || !e.RTCPeerConnection) return;\n  const t = e.RTCPeerConnection.prototype.addTransceiver;\n  t &&\n    (e.RTCPeerConnection.prototype.addTransceiver = function () {\n      this.setParametersPromises = [];\n      const e = arguments[1],\n        i = e && 'sendEncodings' in e;\n      i &&\n        e.sendEncodings.forEach(e => {\n          if ('rid' in e && !/^[a-z0-9]{0,16}$/i.test(e.rid))\n            throw new TypeError('Invalid RID value provided.');\n          if (\n            'scaleResolutionDownBy' in e &&\n            !(parseFloat(e.scaleResolutionDownBy) >= 1)\n          )\n            throw new RangeError('scale_resolution_down_by must be >= 1.0');\n          if ('maxFramerate' in e && !(parseFloat(e.maxFramerate) >= 0))\n            throw new RangeError('max_framerate must be >= 0.0');\n        });\n      const r = t.apply(this, arguments);\n      if (i) {\n        const { sender: t } = r,\n          i = t.getParameters();\n        (!('encodings' in i) ||\n          (1 === i.encodings.length &&\n            0 === Object.keys(i.encodings[0]).length)) &&\n          ((i.encodings = e.sendEncodings),\n          (t.sendEncodings = e.sendEncodings),\n          this.setParametersPromises.push(","sourceCodeStart":19743,"sourceCodeEnd":19779,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/frontend/src/utils/avatar-sdk-web_3.1.2.1002/xrtc-player-BJTnVhG9.js#L19743-L19779","documentation":"Thrown by the adapter.js addTransceiver polyfill when a sendEncodings entry in the init dict contains a 'rid' value that does not match the spec-mandated pattern ^[a-z0-9]{0,16}$ (case-insensitive). RID (restriction identifier) names must be short alphanumeric strings; anything with hyphens, underscores, symbols, or longer than 16 characters is rejected with a TypeError.","triggerScenarios":"pc.addTransceiver(track, { sendEncodings: [{ rid: 'high-res' }] }) — a rid containing '-' or '_' or exceeding 16 characters; programmatically generated rids with punctuation; simulcast configs copied from non-standard examples.","commonSituations":"Configuring simulcast layers with descriptive rid names like 'fhd'/'1080p' (hyphen or digits+letters are fine but '1080-p' is not), templated configs from other SDKs using different rid rules, or user-supplied layer names flowing into sendEncodings.","solutions":["Use only 0-16 alphanumeric characters for rid, e.g. 'q', 'h', 'f' or 'low', 'mid', 'high'.","Validate rids against /^[a-z0-9]{0,16}$/i before building sendEncodings.","Sanitize or map externally supplied layer names to compliant rid identifiers.","If rid semantics are not needed, omit rid entirely and let the browser/simulcast defaults apply."],"exampleFix":"// before\naddTransceiver(track, { sendEncodings: [{ rid: 'high-quality' }, { rid: 'low_res' }] });\n\n// after\naddTransceiver(track, { sendEncodings: [{ rid: 'hq' }, { rid: 'lq' }] });","handlingStrategy":"validation","validationCode":"function validEncodings(encs) {\n  return encs.every(e => !('rid' in e) || /^[a-z0-9]{0,16}$/i.test(e.rid));\n}\n// call addTransceiver only if validEncodings(sendEncodings)","typeGuard":"function hasValidRid(e) {\n  return typeof e === 'object' && (!('rid' in e) || (typeof e.rid === 'string' && /^[a-z0-9]{0,16}$/i.test(e.rid)));\n}","tryCatchPattern":"try {\n  pc.addTransceiver(track, { sendEncodings });\n} catch (e) {\n  if (e instanceof TypeError && /RID/.test(e.message)) {\n    // sanitize rids and retry with compliant identifiers\n  } else throw e;\n}","preventionTips":["Keep rids to <=16 alphanumeric characters.","Validate user/config-supplied layer names before mapping to rid.","Copy simulcast configs only from spec-compliant examples.","Omit rid when simulcast layer naming is not required."],"tags":["webrtc","polyfill","simulcast","validation"],"backgroundTag":"invalid-argument-format","analyzedSha":"5e758547a83371a5a4b29dadf4ac03e8dd527635","analyzedAt":"2026-09-12T08:03:51.356Z","contentChangedAt":"2026-09-12T08:03:51.356Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}