{"record":{"id":"c7676c76f9661ec9","repo":"BabylonJS/Babylon.js","slug":"cannot-slerp-value-a","errorCode":null,"errorMessage":"Cannot slerp value ${a}","messagePattern":"Cannot slerp value (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.ts","lineNumber":386,"sourceCode":"\n/**\n * Spherical linear interpolation between two vectors.\n * Supports float2 and float3 vectors; the interpolation coefficient is a number.\n */\nexport class FlowGraphVectorSlerpBlock extends FlowGraphTernaryOperationBlock<FlowGraphVector, FlowGraphVector, number, FlowGraphVector> {\n    constructor(config?: IFlowGraphBlockConfiguration) {\n        super(RichTypeAny, RichTypeAny, RichTypeNumber, RichTypeAny, (a, b, c) => this._polymorphicSlerp(a, b, c), FlowGraphBlockNames.VectorSlerp, config);\n    }\n\n    private _polymorphicSlerp(a: FlowGraphVector, b: FlowGraphVector, c: number): FlowGraphVector {\n        const className = _GetClassNameOf(a);\n        switch (className) {\n            case FlowGraphTypes.Vector2:\n                return GetVector2Slerp(a as Vector2, b as Vector2, c);\n            case FlowGraphTypes.Vector3:\n                return GetVector3Slerp(a as Vector3, b as Vector3, c);\n            default:\n                throw new Error(`Cannot slerp value ${a}`);\n        }\n    }\n}\n\n/**\n * The configuration of the FlowGraphQuaternionFromAnglesBlock.\n */\nexport interface IFlowGraphQuaternionFromAnglesBlockConfiguration extends IFlowGraphBlockConfiguration {\n    /**\n     * The intrinsic Tait–Bryan rotation order, one of `xyz`, `xzy`, `yxz`, `yzx`, `zxy`, `zyx`.\n     * Any other (or missing) value falls back to the spec default `yxz`.\n     */\n    order?: string;\n}\n\n/**\n * Creates a rotation quaternion from three Tait–Bryan intrinsic Euler angles applied in a\n * configurable order.","sourceCodeStart":368,"sourceCodeEnd":404,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphVectorMathBlocks.pure.ts#L368-L404","documentation":"_polymorphicSlerp dispatches spherical-linear interpolation based on the runtime class name of `a`, supporting only FlowGraphTypes.Vector2 and Vector3. Any other value (scalar, Vector4, quaternion, undefined) hits the default branch and throws. It exists so one slerp block can serve multiple vector types.","triggerScenarios":"Passing a value whose className is neither Vector2 nor Vector3 to the slerp vector-math block — e.g. a Vector4, a raw number, or an uninitialized data input.","commonSituations":"Connecting a Vector4 output into a slerp block; leaving the input data input unconnected so it resolves to undefined; hand-editing serialized graph JSON and changing a type.","solutions":["Use Vector2 or Vector3 inputs for the slerp block; convert other types first","Ensure the input data inputs are connected and typed before execution","For quaternions use Quaternion.Slerp (via the quaternion math blocks) instead"],"exampleFix":"// before\nconst r = slerpBlock.execute(vector4A, vector4B, t); // throws\n// after\nconst r = Vector3.Lerp(new Vector3(a.x, a.y, a.z), new Vector3(b.x, b.y, b.z), t);","handlingStrategy":"type-guard","validationCode":"if (!(a instanceof BABYLON.Vector2 || a instanceof BABYLON.Vector3)) throw new TypeError('slerp requires Vector2 or Vector3');","typeGuard":"const isSlerpable = (v: unknown): v is BABYLON.Vector2 | BABYLON.Vector3 =>\n  v instanceof BABYLON.Vector2 || v instanceof BABYLON.Vector3;","tryCatchPattern":"try { return _polymorphicSlerp(a, b, t); } catch (e) { if (e.message.startsWith('Cannot slerp value')) { return Vector3.Lerp(toVec3(a), toVec3(b), t); } throw e; }","preventionTips":["Connect only Vector2/Vector3 outputs to slerp blocks","Initialize all data inputs before execution","Use quaternion slerp blocks for quaternion inputs instead"],"tags":["flow-graph","type-error","math"],"backgroundTag":"unsupported-input-type","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}