{"record":{"id":"cb6cb9bcbff1e31b","repo":"BabylonJS/Babylon.js","slug":"context-unsupported-action-action","errorCode":null,"errorMessage":"${context}: Unsupported action ${action}","messagePattern":"(.+?): Unsupported action (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/loaders/src/glTF/2.0/Extensions/MSFT_audio_emitter.pure.ts","lineNumber":282,"sourceCode":"        switch (action) {\r\n            case IMSFTAudioEmitter_AnimationEventAction.play: {\r\n                return (currentFrame: number) => {\r\n                    const frameOffset = (startOffset || 0) + (currentFrame - time);\r\n                    sound.play(frameOffset);\r\n                };\r\n            }\r\n            case IMSFTAudioEmitter_AnimationEventAction.stop: {\r\n                return () => {\r\n                    sound.stop();\r\n                };\r\n            }\r\n            case IMSFTAudioEmitter_AnimationEventAction.pause: {\r\n                return () => {\r\n                    sound.pause();\r\n                };\r\n            }\r\n            default: {\r\n                throw new Error(`${context}: Unsupported action ${action}`);\r\n            }\r\n        }\r\n    }\r\n\r\n    // eslint-disable-next-line @typescript-eslint/promise-function-async, no-restricted-syntax\r\n    private _loadAnimationEventAsync(\r\n        context: string,\r\n        animationContext: string,\r\n        animation: IAnimation,\r\n        event: ILoaderAnimationEvent,\r\n        babylonAnimationGroup: AnimationGroup\r\n    ): Promise<void> {\r\n        if (babylonAnimationGroup.targetedAnimations.length == 0) {\r\n            return Promise.resolve();\r\n        }\r\n        const babylonAnimation = babylonAnimationGroup.targetedAnimations[0];\r\n        const emitterIndex = event.emitter;\r\n        const emitter = ArrayItem.Get(`/extensions/${this.name}/emitters`, this._emitters, emitterIndex);\r","sourceCodeStart":264,"sourceCodeEnd":300,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/loaders/src/glTF/2.0/Extensions/MSFT_audio_emitter.pure.ts#L264-L300","documentation":"MSFT_audio_emitter animation events map an action enum (stop/pause/play) to a sound callback via _getEventAction. If the event's action value is outside the known enum values, no callback can be built and the loader throws with the numeric action and event context.","triggerScenarios":"Loading a glTF animation event whose MSFT_audio_emitter extension data has an 'action' value not equal to 0 (stop), 1 (play), or 2 (pause) — e.g. corrupted data or a newer spec revision with unknown action codes.","commonSituations":"Hand-edited glTF action values; exporters emitting wrong action numbers; assets produced against a draft version of the extension with different enum values.","solutions":["Fix the animation event's action value to a valid enum (0=stop, 1=play, 2=pause).","Re-export the asset with a conformant MSFT_audio_emitter writer.","Remove the offending animation event from the extension data."],"exampleFix":"// before\n{ \"action\": 5, \"sound\": 0 }\n// after\n{ \"action\": 1, \"sound\": 0 }","handlingStrategy":"validation","validationCode":"const VALID_ACTIONS = [0, 1, 2]; // stop, play, pause\nevents.forEach(ev => { if (!VALID_ACTIONS.includes(ev.action)) throw new Error('Invalid audio emitter action: ' + ev.action); });","typeGuard":"function hasValidAction(ev: { action: number }): boolean {\n  return ev.action === 0 || ev.action === 1 || ev.action === 2;\n}","tryCatchPattern":"try { await loader.loadAsync(url); } catch (e) {\n  if (e.message.includes('Unsupported action')) {\n    // sanitize animation event actions to a known enum and retry\n  } else throw e;\n}","preventionTips":["Clamp action values to the documented enum (0/1/2) at export time.","Validate animation event extension data in CI.","Track spec changes of MSFT_audio_emitter when regenerating assets."],"tags":["gltf","audio","animation","enum","extensions"],"backgroundTag":"unsupported-enum-value","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}