{"record":{"id":"8053dd4234e3bc14","repo":"BabylonJS/Babylon.js","slug":"error-parsing-events","errorCode":null,"errorMessage":"Error parsing events","messagePattern":"Error parsing events","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.ts","lineNumber":211,"sourceCode":"            value[0] = parseFloat(value[0]);\n        }\n        return { type: type.flowGraphType, value: dataTransform ? dataTransform(value, this) : value };\n    }\n\n    private _parseEvents() {\n        if (!this._interactivityGraph.events) {\n            return;\n        }\n        for (const event of this._interactivityGraph.events) {\n            const converted: InteractivityEvent = {\n                eventId: event.id || \"internalEvent_\" + this._internalEventsCounter++,\n            };\n            if (event.values) {\n                converted.eventData = Object.keys(event.values).map((key) => {\n                    const eventValue = event.values?.[key];\n                    if (!eventValue) {\n                        Logger.Error([\"No value found for event key\", key]);\n                        throw new Error(\"Error parsing events\");\n                    }\n                    const type = this._types[eventValue.type];\n                    if (!type) {\n                        Logger.Error([\"No type found for event value\", eventValue]);\n                        throw new Error(\"Error parsing events\");\n                    }\n                    const value = typeof eventValue.value !== \"undefined\" ? this._parseVariable(eventValue) : undefined;\n                    return {\n                        id: key,\n                        type: type.flowGraphType,\n                        eventData: true,\n                        value,\n                    };\n                });\n            }\n            this._events.push(converted);\n        }\n    }","sourceCodeStart":193,"sourceCodeEnd":229,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/loaders/src/glTF/2.0/Extensions/KHR_interactivity/interactivityGraphParser.ts#L193-L229","documentation":"Thrown in _parseEvents while mapping a custom event's `values` object: a key resolved to a null/undefined value entry. This guards against sparse or malformed event value objects in the glTF, which per spec should always map keys to a value descriptor (type + optional value).","triggerScenarios":"An event's `values` object contains a key whose value is null, undefined, or empty (e.g. `{ \"myParam\": null }`) while the parser iterates Object.keys(event.values) and dereferences each entry.","commonSituations":"Hand-edited or tool-merged glTF files where an event value was deleted but its key left behind; exporters emitting explicit null entries; JSON merge patches leaving nulls.","solutions":["Remove the null/empty key from the event's `values` object in the glTF asset","Give the key a valid value descriptor `{ \"type\": <index>, \"value\": [...] }`","Check the console log (\"No value found for event key\") to identify the offending key","Re-export the asset with a current exporter to regenerate a clean events section"],"exampleFix":"// before\n\"values\": { \"speed\": null }\n// after\n\"values\": { \"speed\": { \"type\": 0, \"value\": [0] } }","handlingStrategy":"validation","validationCode":"for (const ev of graph.events ?? []) {\n  for (const [key, val] of Object.entries(ev.values ?? {})) {\n    if (val == null) throw new Error(`Event ${ev.id}: value for key '${key}' is null/empty`);\n  }\n}","typeGuard":"function hasValidEventValues(ev: { values?: Record<string, unknown> | null }): boolean {\n  return !ev.values || Object.values(ev.values).every((v) => v != null);\n}","tryCatchPattern":"try {\n  const parser = new InteractivityGraphToFlowGraphParser(graph, gltf);\n} catch (e) {\n  if (e.message === 'Error parsing events') {\n    console.warn('Malformed event values; dropping events and continuing');\n    graph.events = undefined;\n    return new InteractivityGraphToFlowGraphParser(graph, gltf);\n  }\n  throw e;\n}","preventionTips":["Never leave null keys inside event `values` objects; delete the key instead","Sanitize glTF files after JSON merge-patch operations","Validate events against the KHR_interactivity schema in CI","Regenerate events sections with a current exporter rather than hand-editing"],"tags":["gltf","khr-interactivity","events","parser"],"backgroundTag":"malformed-event-values","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}