{"record":{"id":"a26a50bba6d9d474","repo":"BabylonJS/Babylon.js","slug":"object-is-undefined","errorCode":null,"errorMessage":"Object is undefined","messagePattern":"Object is undefined","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.ts","lineNumber":97,"sourceCode":"    ) {\n        super(RichTypeAny, config);\n        this.object = this.registerDataOutput(\"object\", RichTypeAny);\n        this.propertyName = this.registerDataOutput(\"propertyName\", RichTypeAny);\n        this.setterFunction = this.registerDataOutput(\"setFunction\", RichTypeAny, this._setPropertyValue.bind(this));\n        this.getterFunction = this.registerDataOutput(\"getFunction\", RichTypeAny, this._getPropertyValue.bind(this));\n        this.generateAnimationsFunction = this.registerDataOutput(\"generateAnimationsFunction\", RichTypeAny, this._getInterpolationAnimationPropertyInfo.bind(this));\n        this.templateComponent = new FlowGraphPathConverterComponent(config.jsonPointer, this);\n    }\n\n    public override _doOperation(context: FlowGraphContext): P {\n        const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);\n        // Pass the context as the accessor payload so context-aware object-model accessors, such as\n        // one validating a delay handle against the runtime active-delay set, can resolve.\n        const value = accessorContainer.info.get(accessorContainer.object, undefined, context) as P;\n        const object = accessorContainer.info.getTarget?.(accessorContainer.object);\n        const propertyName = accessorContainer.info.getPropertyName?.[0](accessorContainer.object);\n        if (!object) {\n            throw new Error(\"Object is undefined\");\n        } else {\n            this.object.setValue(object, context);\n            if (propertyName) {\n                this.propertyName.setValue(propertyName, context);\n            }\n        }\n        return value;\n    }\n\n    private _setPropertyValue(_target: O, _propertyName: string, value: P, context: FlowGraphContext): void {\n        const accessorContainer = this.templateComponent.getAccessor(this.config.pathConverter, context);\n        const type = accessorContainer.info.type;\n        if (type.startsWith(\"Color\")) {\n            value = ToColor(value as Vector4, type) as unknown as P;\n        }\n        // Unwrap FlowGraphInteger to plain number for numeric setters\n        if (typeof (value as any)?.value === \"number\" && (value as any)?.getClassName?.() === \"FlowGraphInteger\") {\n            value = (value as any).value as unknown as P;","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FlowGraph/Blocks/Data/Transformers/flowGraphJsonPointerParserBlock.pure.ts#L79-L115","documentation":"FlowGraphJsonPointerParserBlock resolves a JSON Pointer path and stores the final target object in its output. After resolving the pointer, if `getTarget` returns no object (null/undefined), the block throws 'Object is undefined'. It means the pointer could not resolve to a concrete container object at runtime.","triggerScenarios":"Evaluating a JSON pointer whose intermediate path segment does not exist (e.g. '/foo/bar/baz' when context.obj.foo.bar is undefined), or an accessor whose getTarget returns undefined for the resolved container.","commonSituations":"Pointers written against a data shape that changed; missing context variables so the path resolves into nothing; typos in pointer segments; accessing optional fields before they are populated.","solutions":["Verify the JSON Pointer path segments match the actual runtime object shape","Log/inspect the accessor's resolved target and intermediate objects before the block runs","Add a guard or conditional execution so the block only runs when the target exists"],"exampleFix":"// before\npointer = '/user/address/city'; // throws if user.address missing\n// after\nif (data.user?.address) { pointer = '/user/address/city'; }","handlingStrategy":"validation","validationCode":"const target = obj && typeof obj === 'object' ? pointerGet(root, pointer) : undefined;\nif (target == null) throw new Error('JSON pointer does not resolve: ' + pointer);","typeGuard":"const isResolvable = (v: unknown): v is Record<string, unknown> => v !== null && typeof v === 'object';","tryCatchPattern":"try { block._doOperation(context); } catch (e) { if (e.message === 'Object is undefined') { /* skip or set default */ } else throw e; }","preventionTips":["Validate JSON Pointer paths against the live data shape before running the graph","Use optional chaining logic upstream to avoid resolving into missing segments","Keep pointer strings and data schema in sync (schema-validate on load)"],"tags":["flow-graph","json-pointer","null-reference"],"backgroundTag":"null-or-undefined-target","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}