{"record":{"id":"283a0ed60fbf7d53","repo":"BabylonJS/Babylon.js","slug":"snippet-snippetid-does-not-contain-a-flow-graph","errorCode":null,"errorMessage":"Snippet ${snippetId} does not contain a flow graph","messagePattern":"Snippet (.+?) does not contain a flow graph","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/core/src/FlowGraph/flowGraphParser.ts","lineNumber":31,"sourceCode":"import { type ISerializedFlowGraph, type ISerializedFlowGraphBlock, type ISerializedFlowGraphContext } from \"./typeDefinitions\";\nimport { type Node } from \"core/node\";\nimport { getRichTypeByFlowGraphType, RichType } from \"./flowGraphRichTypes.pure\";\nimport { type FlowGraphConnection } from \"./flowGraphConnection\";\nimport { Constants } from \"core/Engines/constants\";\nimport { WebRequest } from \"core/Misc/webRequest\";\n\nasync function GetSerializedFlowGraphFromSnippetAsync(snippetId: string): Promise<any> {\n    const response = await WebRequest.FetchAsync(Constants.SnippetUrl + \"/\" + snippetId.replace(/#/g, \"/\"));\n    if (!response.ok) {\n        throw new Error(\"Unable to load the snippet \" + snippetId);\n    }\n\n    const text = new TextDecoder().decode(await response.arrayBuffer());\n    const snippet = JSON.parse(text);\n    const snippetPayload = JSON.parse(snippet.jsonPayload);\n    const flowGraphPayload = snippetPayload.flowGraph;\n    if (!flowGraphPayload) {\n        throw new Error(\"Snippet \" + snippetId + \" does not contain a flow graph\");\n    }\n\n    return typeof flowGraphPayload === \"string\" ? JSON.parse(flowGraphPayload) : flowGraphPayload;\n}\n\nfunction ApplyCoordinatorSerializationSettings(serializedObject: any, coordinator: FlowGraphCoordinator): void {\n    if (serializedObject.dispatchEventsSynchronously !== undefined) {\n        coordinator.dispatchEventsSynchronously = serializedObject.dispatchEventsSynchronously;\n    }\n\n    if (serializedObject._defaultValues) {\n        for (const key in serializedObject._defaultValues) {\n            getRichTypeByFlowGraphType(key).defaultValue = serializedObject._defaultValues[key];\n        }\n    }\n}\n\n/**","sourceCodeStart":13,"sourceCodeEnd":49,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/core/src/FlowGraph/flowGraphParser.ts#L13-L49","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Re-export the flow graph from the node editor and save it as a new snippet, then use that id","Confirm the snippet is a flow graph snippet (payload contains flowGraph) before parsing","If the payload embeds flowGraph as a string, ensure it is non-empty","Fall back to parsing a locally stored serialized flow graph object instead"],"exampleFix":"// before\nconst graph = await FlowGraphParser.ParseFlowGraphAsync(particleSnippetId);\n// after\nconst graph = await FlowGraphParser.ParseFlowGraphAsync(flowGraphSnippetId);","handlingStrategy":"validation","validationCode":"async function fetchSnippetPayload(snippetId: string): Promise<any> {\n  const res = await fetch(`${SNIPPET_URL}/${snippetId.replace(/#/g, '/')}`);\n  const snippet = await res.json();\n  const payload = JSON.parse(snippet.jsonPayload);\n  if (!payload.flowGraph) throw new Error(`Snippet ${snippetId} is not a flow graph snippet`);\n  return payload.flowGraph;\n}","typeGuard":"function isFlowGraphSnippet(payload: any): boolean {\n  return payload != null && typeof payload === 'object' && !!payload.flowGraph;\n}","tryCatchPattern":"try {\n  const graph = await FlowGraphParser.ParseFlowGraphAsync(snippetId);\n} catch (e) {\n  if (String(e.message).includes('does not contain a flow graph')) {\n    // snippet id points to a non-flow-graph snippet; prompt user for correct id\n  }\n}","preventionTips":["Only share snippet ids exported from the flow graph / node editor","Do not reuse ids from the particle or materials editors","Validate snippet payloads before passing ids to the parser"],"tags":["babylonjs","snippets","deserialization","invalid-content"],"backgroundTag":"missing-required-payload","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}