{"record":{"id":"11ffe3806bf02e7c","repo":"BabylonJS/Babylon.js","slug":"invalid-flowgraph-block-module-for-blockname","errorCode":null,"errorMessage":"Invalid FlowGraph block module for ${blockName}","messagePattern":"Invalid FlowGraph block module for (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FlowGraph/Blocks/flowGraphBlockFactory.ts","lineNumber":45,"sourceCode":"function _IsFlowGraphBlockConstructor(value: unknown): value is typeof FlowGraphBlock {\n    return typeof value === \"function\" && value.prototype instanceof FlowGraphBlock;\n}\n\nasync function _LoadBlock(modulePromise: Promise<object>, blockName: string): Promise<typeof FlowGraphBlock> {\n    const module = await modulePromise;\n    let block: typeof FlowGraphBlock | undefined;\n    let register: (() => void) | undefined;\n\n    for (const [exportName, value] of Object.entries(module)) {\n        if (exportName === blockName && _IsFlowGraphBlockConstructor(value)) {\n            block = value;\n        } else if (exportName.startsWith(\"RegisterFlowGraph\") && typeof value === \"function\") {\n            register = value;\n        }\n    }\n\n    if (!block || !register) {\n        throw new Error(`Invalid FlowGraph block module for ${blockName}`);\n    }\n\n    register();\n    if (blockName === \"FlowGraphPlayAnimationBlock\") {\n        const { RegisterAnimationGroup } = await import(\"../../Animations/animationGroup.pure\");\n        RegisterAnimationGroup();\n    }\n\n    return block;\n}\n\n/**\n * a function to get a factory function for a block.\n * @param blockName the block name to initialize. If the block comes from an external module, the name should be in the format \"module/blockName\"\n * @returns an async factory function that will return the block class when called.\n */\n// eslint-disable-next-line @typescript-eslint/naming-convention\nexport function blockFactory(blockName: FlowGraphBlockNames | string): () => Promise<typeof FlowGraphBlock> {","sourceCodeStart":27,"sourceCodeEnd":63,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FlowGraph/Blocks/flowGraphBlockFactory.ts#L27-L63","documentation":"_LoadBlock dynamically imports a block's module and looks for the block class export and its RegisterFlowGraph* side-effect function. If the module doesn't export a usable block and/or register function, it throws 'Invalid FlowGraph block module for <blockName>'. This indicates the dynamic module failed to provide the expected surface.","triggerScenarios":"blockFactory requests a blockName whose module exists but lacks the expected exports (block class not exported, or no Register* function), e.g. a renamed internal export or a stub/failed dynamic import result.","commonSituations":"Version mismatch where a block was renamed or removed; custom bundling/tree-shaking stripping named exports; typos in block names that resolve to the wrong module; broken dynamic-import chunking in builds.","solutions":["Verify the block name matches an existing exported FlowGraph block for the installed core version","Ensure your bundler preserves the dynamic import module's named exports (don't tree-shake the FlowGraph Blocks modules)","Import and call the block's Register function explicitly at startup instead of relying on dynamic loading"],"exampleFix":"// before\nconst block = await blockFactory('FlowGraphTypoBlock', config); // invalid module\n// after\nconst block = await blockFactory('FlowGraphSetVariableBlock', config);","handlingStrategy":"validation","validationCode":"const mod = await import(blockPath);\nif (typeof mod[blockName] !== 'function') throw new Error('Module missing block export: ' + blockName);","typeGuard":null,"tryCatchPattern":"try { block = await blockFactory(name, cfg); } catch (e) { if (e.message.startsWith('Invalid FlowGraph block module')) { /* register block explicitly or skip */ } else throw e; }","preventionTips":["Keep block names in sync with the installed @babylonjs/core version's exports","Configure the bundler to keep FlowGraph module named exports (no aggressive tree-shaking)","Explicitly import+register blocks you use instead of relying on dynamic import alone"],"tags":["flow-graph","module-resolution","dynamic-import"],"backgroundTag":"missing-module-export","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}