{"record":{"id":"19cac562bb418eef","repo":"BabylonJS/Babylon.js","slug":"cannot-get-isinf-of-a","errorCode":null,"errorMessage":"Cannot get isInf of ${a}","messagePattern":"Cannot get isInf of (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.ts","lineNumber":875,"sourceCode":"        } else {\r\n            throw new Error(`Cannot get NaN of ${a}`);\r\n        }\r\n    }\r\n}\r\n\r\n/**\r\n * Is Inf block.\r\n */\r\nexport class FlowGraphIsInfinityBlock extends FlowGraphUnaryOperationBlock<FlowGraphNumber, boolean> {\r\n    constructor(config?: IFlowGraphBlockConfiguration) {\r\n        super(RichTypeAny, RichTypeBoolean, (a) => this._polymorphicIsInf(a), FlowGraphBlockNames.IsInfinity, config);\r\n    }\r\n\r\n    private _polymorphicIsInf(a: FlowGraphNumber) {\r\n        if (isNumeric(a)) {\r\n            return !isFinite(getNumericValue(a));\r\n        } else {\r\n            throw new Error(`Cannot get isInf of ${a}`);\r\n        }\r\n    }\r\n}\r\n\r\n/**\r\n * Convert degrees to radians block.\r\n */\r\nexport class FlowGraphDegToRadBlock extends FlowGraphUnaryOperationBlock<FlowGraphMathOperationType, FlowGraphMathOperationType> {\r\n    /**\r\n     * Constructs a new instance of the flow graph math block.\r\n     * @param config - Optional configuration for the flow graph block.\r\n     */\r\n    constructor(config?: IFlowGraphBlockConfiguration) {\r\n        super(RichTypeAny, RichTypeAny, (a) => this._polymorphicDegToRad(a), FlowGraphBlockNames.DegToRad, config);\r\n    }\r\n\r\n    private _degToRad(a: number) {\r\n        return (a * Math.PI) / 180;\r","sourceCodeStart":857,"sourceCodeEnd":893,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FlowGraph/Blocks/Data/Math/flowGraphMathBlocks.pure.ts#L857-L893","documentation":"The IsInf (is infinity) flow graph block's _polymorphicIsInf requires its input to pass isNumeric() — a plain number or FlowGraphInteger. It then checks !isFinite(value). Any other value type (boolean, string, vector, quaternion) is rejected with 'Cannot get isInf of ...' because infinity is only meaningful for numbers.","triggerScenarios":"Connecting a non-numeric value (boolean, string, Vector2/3/4, Quaternion) into the IsInf block input and executing the flow graph; note FlowGraphInteger is accepted by isNumeric even though integer infinity is unusual.","commonSituations":"Wiring a division result that was expected to be numeric but is a vector (e.g. matrix divide branch output); testing a string against Infinity; accidental connection of a boolean logic output.","solutions":["Ensure the input connection produces a number; add an extraction or conversion block (Number(...)) before the IsInf block.","If you need to test vectors/matrix results, decompose into components and test each numeric component.","Fix the upstream wiring so the correct numeric output port feeds the block."],"exampleFix":"// before: vector into IsInf\nisInfBlock.value.connect(vecDivideBlock.output); // throws\n\n// after: numeric component\nconst x = new FlowGraphGetXBlock();\nx.value.connect(vecDivideBlock.output);\nisInfBlock.value.connect(x.output);","handlingStrategy":"type-guard","validationCode":"// before IsInf block runs\nfunction validIsInfInput(v) {\n  return typeof v === 'number' || (typeof v === 'object' && v !== null && 'value' in v);\n}\nif (!validIsInfInput(isInfInput)) throw new TypeError('IsInf input must be a number or FlowGraphInteger');","typeGuard":"function isNumericValue(v): v is number | FlowGraphInteger {\n  return typeof v === 'number' || (typeof v === 'object' && v !== null && 'value' in v);\n}","tryCatchPattern":"try {\n  result = isInfBlock.evaluate(context);\n} catch (e) {\n  if (e.message.startsWith('Cannot get isInf of')) {\n    result = false; // treat non-numeric as not-infinite\n  } else { throw e; }\n}","preventionTips":["Only connect arithmetic-block outputs (number-producing) to IsInf.","For vectors, decompose into components and check each individually.","Guard division blocks upstream so they cannot feed non-numeric branch outputs into IsInf."],"tags":["babylonjs","flow-graph","infinity","type-mismatch"],"backgroundTag":"non-numeric-operand","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}