BabylonJS/Babylon.js · error · Error

Snippet ${snippetId} does not contain a flow graph

Error message

Snippet ${snippetId} does not contain a flow graph

What it means

Thrown by GetSerializedFlowGraphFromSnippetAsync when the snippet was fetched successfully but its JSON payload has no flowGraph property. The snippet server stored content, but it is not a flow graph snippet.

Source

Thrown at packages/dev/core/src/FlowGraph/flowGraphParser.ts:31

import { type ISerializedFlowGraph, type ISerializedFlowGraphBlock, type ISerializedFlowGraphContext } from "./typeDefinitions";
import { type Node } from "core/node";
import { getRichTypeByFlowGraphType, RichType } from "./flowGraphRichTypes.pure";
import { type FlowGraphConnection } from "./flowGraphConnection";
import { Constants } from "core/Engines/constants";
import { WebRequest } from "core/Misc/webRequest";

async function GetSerializedFlowGraphFromSnippetAsync(snippetId: string): Promise<any> {
    const response = await WebRequest.FetchAsync(Constants.SnippetUrl + "/" + snippetId.replace(/#/g, "/"));
    if (!response.ok) {
        throw new Error("Unable to load the snippet " + snippetId);
    }

    const text = new TextDecoder().decode(await response.arrayBuffer());
    const snippet = JSON.parse(text);
    const snippetPayload = JSON.parse(snippet.jsonPayload);
    const flowGraphPayload = snippetPayload.flowGraph;
    if (!flowGraphPayload) {
        throw new Error("Snippet " + snippetId + " does not contain a flow graph");
    }

    return typeof flowGraphPayload === "string" ? JSON.parse(flowGraphPayload) : flowGraphPayload;
}

function ApplyCoordinatorSerializationSettings(serializedObject: any, coordinator: FlowGraphCoordinator): void {
    if (serializedObject.dispatchEventsSynchronously !== undefined) {
        coordinator.dispatchEventsSynchronously = serializedObject.dispatchEventsSynchronously;
    }

    if (serializedObject._defaultValues) {
        for (const key in serializedObject._defaultValues) {
            getRichTypeByFlowGraphType(key).defaultValue = serializedObject._defaultValues[key];
        }
    }
}

/**

View on GitHub (pinned to 0592b347b8)

Solutions

  1. Re-export the flow graph from the node editor and save it as a new snippet, then use that id
  2. Confirm the snippet is a flow graph snippet (payload contains flowGraph) before parsing
  3. If the payload embeds flowGraph as a string, ensure it is non-empty
  4. Fall back to parsing a locally stored serialized flow graph object instead

Example fix

// before
const graph = await FlowGraphParser.ParseFlowGraphAsync(particleSnippetId);
// after
const graph = await FlowGraphParser.ParseFlowGraphAsync(flowGraphSnippetId);
Defensive patterns

Strategy: validation

Validate before calling

async function fetchSnippetPayload(snippetId: string): Promise<any> {
  const res = await fetch(`${SNIPPET_URL}/${snippetId.replace(/#/g, '/')}`);
  const snippet = await res.json();
  const payload = JSON.parse(snippet.jsonPayload);
  if (!payload.flowGraph) throw new Error(`Snippet ${snippetId} is not a flow graph snippet`);
  return payload.flowGraph;
}

Type guard

function isFlowGraphSnippet(payload: any): boolean {
  return payload != null && typeof payload === 'object' && !!payload.flowGraph;
}

Try / catch

try {
  const graph = await FlowGraphParser.ParseFlowGraphAsync(snippetId);
} catch (e) {
  if (String(e.message).includes('does not contain a flow graph')) {
    // snippet id points to a non-flow-graph snippet; prompt user for correct id
  }
}

Prevention

When it happens

Trigger: Parsing a snippetId whose jsonPayload lacks a flowGraph field, e.g. the id points to a particle-system, materials, or scene snippet instead of a flow graph saved from the node editor.

Common situations: Copying a snippet id from the wrong Babylon.js tool (particle editor, materials editor, playground); saving the wrong payload type to a snippet; truncated/older snippet payloads.

Related errors


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