BabylonJS/Babylon.js · error · Error

Unknown block name ${blockName}

Error message

Unknown block name ${blockName}

What it means

blockFactory resolves block names through known registries (CustomBlocks and ShortNameToFullKey). When the name has no '/' path form and is not found in the short-name map or custom blocks registry, it throws 'Unknown block name <blockName>'. The requested block simply isn't registered in this runtime.

Source

Thrown at packages/dev/core/src/FlowGraph/Blocks/flowGraphBlockFactory.ts:426

        case FlowGraphBlockNames.AudioSoundEndedEvent:
            return async () => await _LoadBlock(import("./Event/flowGraphSoundEndedEventBlock.pure"), "FlowGraphSoundEndedEventBlock");
        case FlowGraphBlockNames.AudioGetVolume:
            return async () => await _LoadBlock(import("./Data/Audio/flowGraphGetSoundVolumeBlock.pure"), "FlowGraphGetSoundVolumeBlock");
        case FlowGraphBlockNames.AudioIsSoundPlaying:
            return async () => await _LoadBlock(import("./Data/Audio/flowGraphIsSoundPlayingBlock.pure"), "FlowGraphIsSoundPlayingBlock");
        default:
            // check if the block is a custom block
            if (CustomBlocks[blockName]) {
                return CustomBlocks[blockName];
            }
            // Fallback: O(1) reverse lookup by short name (e.g. "FlowGraphGLTFDataProvider" → "KHR_interactivity/FlowGraphGLTFDataProvider")
            if (!blockName.includes("/")) {
                const fullKey = ShortNameToFullKey[blockName];
                if (fullKey && CustomBlocks[fullKey]) {
                    return CustomBlocks[fullKey];
                }
            }
            throw new Error(`Unknown block name ${blockName}`);
    }
}

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Import the block's module (side-effect import) so its Register function runs before blockFactory is used
  2. Check the exact block name spelling/casing against ShortNameToFullKey
  3. If it's a custom block, register it via the custom-block registration API before parsing the graph

Example fix

// before
const block = await blockFactory('FlowGraphSendCustomEventBlock', cfg); // unknown
// after
import "@babylonjs/core/FlowGraph/Blocks/Execution/flowGraphSendCustomEventBlock";
const block = await blockFactory('FlowGraphSendCustomEventBlock', cfg);
Defensive patterns

Strategy: try-catch

Validate before calling

if (!(blockName in ShortNameToFullKey) && !(blockName in CustomBlocks)) {
  throw new Error('Block not registered: ' + blockName);
}

Try / catch

try { block = await blockFactory(name, cfg); } catch (e) { if (e.message.startsWith('Unknown block name')) { console.warn('Skipping unregistered block', name); return null; } throw e; }

Prevention

When it happens

Trigger: Calling blockFactory('FlowGraphFooBlock', config) where the block was never registered (RegisterFlowGraphFooBlock not called), or the name is misspelled/uses the wrong casing.

Common situations: Forgetting to import side-effect modules (e.g. "@babylonjs/core/FlowGraph/Blocks") that register blocks; custom blocks registered under a different key; graphs authored in a different Babylon version referencing renamed blocks.

Related errors


AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30). Data as JSON: /api/errors/057743685ea5307c. Report an issue: GitHub.