{"record":{"id":"29178fc6a0732941","repo":"iflytek/astron-agent","slug":"invalid-parameter","errorCode":"INVALID_PARAMETER","errorMessage":"parameter must be numeric type","messagePattern":"parameter must be numeric type","errorType":"error_code","errorClass":"X","httpStatus":null,"severity":"error","filePath":"console/frontend/src/utils/avatar-sdk-web_3.1.2.1002/xrtc-player-BJTnVhG9.js","lineNumber":18263,"sourceCode":"                }, e);\n              })\n            )),\n            function () {\n              return t.apply(this, arguments);\n            }),\n        },\n        {\n          key: 'enableMicVolume',\n          value: function () {\n            var e =\n                arguments.length > 0 && void 0 !== arguments[0]\n                  ? arguments[0]\n                  : 1e3,\n              t = arguments.length > 1 ? arguments[1] : void 0,\n              i = this;\n            if (e >= 0) {\n              if ('number' != typeof e)\n                throw new X({\n                  code: B.INVALID_PARAMETER,\n                  message: 'parameter must be numeric type',\n                });\n              navigator.mediaDevices\n                .getUserMedia({ audio: { deviceId: { exact: t } } })\n                .then(function (t) {\n                  (i.logger.info('microphone permission is ok'),\n                    (i.micStream = t),\n                    (i.soundMeter = new Q()),\n                    i.soundMeter.connectToSource(\n                      i.micStream.getAudioTracks()[0]\n                    ),\n                    (i.timer = setInterval(\n                      function () {\n                        i._emitter.emit('mic-volume', {\n                          volumes: Math.round(100 * i.soundMeter.getVolume()),\n                        });\n                      },","sourceCodeStart":18245,"sourceCodeEnd":18281,"githubUrl":"https://github.com/iflytek/astron-agent/blob/5e758547a83371a5a4b29dadf4ac03e8dd527635/console/frontend/src/utils/avatar-sdk-web_3.1.2.1002/xrtc-player-BJTnVhG9.js#L18245-L18281","documentation":"This is a custom SDK error (code INVALID_PARAMETER) thrown by the bundled TRTC/XRTC player SDK when setAudioDeviceVolume-like volume APIs are called with a first argument that is >= 0 but is not of primitive type 'number'. The bundled code guards against strings (e.g. '100') or objects being passed where a numeric volume/device id is required, and fails fast with this typed error instead of misbehaving later inside getUserMedia or the audio pipeline.","triggerScenarios":"Calling an SDK volume/device API whose first parameter must be a number, but passing a non-number that still satisfies the >= 0 precheck path, e.g. a numeric string '80', null, or an object parsed from config. The check 'number' != typeof e throws even for values that would coerce cleanly, so any typeof !== 'number' input triggers it.","commonSituations":"Developers read a volume setting from an HTML input (value is always a string) or from JSON/localStorage config and pass it straight into the SDK API; TypeScript types are stripped at runtime so a string slips through. Also common when values come from the avatar console backend as strings.","solutions":["Convert the argument with Number() before calling the SDK API and check Number.isFinite.","If the value comes from an input element or JSON config, parse it explicitly (parseFloat/parseInt) rather than passing the raw string.","Ensure 0 is a valid fallback; if the argument is undefined the SDK defaults to 1000, so only explicitly-passed non-numeric values throw.","Pin/inspect the avatar SDK bundle (xrtc-player) version if the API signature changed after an upgrade."],"exampleFix":"// before\nplayer.setVolume(formData.volume); // '80' (string from input)\n// after\nconst vol = Number(formData.volume);\nif (!Number.isFinite(vol) || vol < 0) throw new Error('volume must be a non-negative number');\nplayer.setVolume(vol);","handlingStrategy":"validation","validationCode":"function isNumericVolume(v) { return typeof v === 'number' && Number.isFinite(v) && v >= 0; }\nif (!isNumericVolume(raw)) throw new TypeError('volume must be a non-negative finite number');","typeGuard":"const isNum = (v) => typeof v === 'number' && Number.isFinite(v);","tryCatchPattern":null,"preventionTips":["Always Number() coerce values coming from DOM inputs, URL params, or JSON config before SDK calls","Enable runtime validation (zod/valibot) on config objects feeding the SDK","Never rely on implicit coercion: the SDK uses typeof, not Number(v)","Add a unit test covering the volume/device API with string input"],"tags":["webrtc","javascript","type-mismatch","avatar-sdk"],"backgroundTag":"type-mismatch","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"}