{"record":{"id":"ab2f4cda94f9038f","repo":"BabylonJS/Babylon.js","slug":"receive-event-should-have-a-single-configuration-o","errorCode":null,"errorMessage":"Receive event should have a single configuration object, the event itself","messagePattern":"Receive event should have a single configuration object, the event itself","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.ts","lineNumber":308,"sourceCode":"        inputs: {},\n        outputs: {\n            values: {\n                timeSinceLastTick: { name: \"deltaTime\", gltfType: \"number\" /*, dataTransformer: (time: number) => time / 1000*/ },\n                // KHR_interactivity `ref event` output (the event reference).\n                event: { name: \"event\" },\n            },\n            flows: {\n                out: { name: \"done\" },\n            },\n        },\n    },\n    \"event/send\": {\n        blocks: [FlowGraphBlockNames.SendCustomEvent],\n        extraProcessor(gltfBlock, declaration, _mapping, parser, serializedObjects) {\n            // set eventId and eventData. The configuration object of the glTF should have a single object.\n            // validate that we are running it on the right block.\n            if (declaration.op !== \"event/send\" || !gltfBlock.configuration || Object.keys(gltfBlock.configuration).length !== 1) {\n                throw new Error(\"Receive event should have a single configuration object, the event itself\");\n            }\n            const eventConfiguration = gltfBlock.configuration[\"event\"];\n            const eventId = eventConfiguration.value?.[0];\n            if (typeof eventId !== \"number\") {\n                throw new Error(\"Event id should be a number\");\n            }\n            const event: InteractivityEvent = parser.arrays.events[eventId];\n            const serializedObject = serializedObjects[0];\n            serializedObject.config ||= {};\n            serializedObject.config.eventId = event.eventId;\n            serializedObject.config.eventData = event.eventData;\n            return serializedObjects;\n        },\n    },\n    \"event/receive\": {\n        blocks: [FlowGraphBlockNames.ReceiveCustomEvent],\n        outputs: {\n            values: {","sourceCodeStart":290,"sourceCodeEnd":326,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity/declarationMapper.ts#L290-L326","documentation":"The KHR_interactivity 'event/send' block mapping expects the glTF block's configuration to contain exactly one key named \"event\" holding the event being sent. The extraProcessor validates the declaration op is event/send and that configuration is a single-key object; otherwise it throws this (slightly misleadingly worded) error before reading the event id.","triggerScenarios":"Parsing a KHR_interactivity graph where an event/send block has no configuration, a configuration with zero or multiple keys, or where the mapping is applied to a block whose declaration.op is not \"event/send\" (mismatched block-to-declaration wiring).","commonSituations":"Assets produced by older interactivity exporters with a different configuration schema; hand-edited JSON renaming or adding configuration keys; a custom declaration map misrouting blocks to the event/send processor.","solutions":["Ensure the event/send glTF block's configuration has exactly one key: { \"event\": { \"value\": [<eventId>] } }","Re-export the asset with a KHR_interactivity-compliant exporter","Verify the block's op is \"event/send\" and that your custom declaration mapping routes it to the correct processor"],"exampleFix":"// before\n\"configuration\": { \"event\": { \"value\": [3] }, \"extra\": true }\n// after\n\"configuration\": { \"event\": { \"value\": [3] } }","handlingStrategy":"validation","validationCode":"function validateSendEventConfig(block) {\n  const keys = block.configuration ? Object.keys(block.configuration) : [];\n  return keys.length === 1 && keys[0] === \"event\" && typeof block.configuration.event.value?.[0] === \"number\";\n}\n// validate every event/send block in glTF.extensions.KHR_interactivity before parsing","typeGuard":null,"tryCatchPattern":"try {\n  await loader.loadAsync(url);\n} catch (e) {\n  if (e instanceof Error && e.message.includes(\"single configuration object\")) {\n    console.error(\"event/send block has malformed configuration; fix the interactivity JSON.\");\n  } else throw e;\n}","preventionTips":["Pre-validate KHR_interactivity blocks against the expected schema before loading","Use a spec-compliant exporter version and avoid hand-editing interactivity JSON","Pin exporter and Babylon.js loader versions that agree on the schema"],"tags":["gltf","interactivity","flow-graph","validation"],"backgroundTag":"gltf-interactivity-invalid-configuration","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}