{"record":{"id":"9a9054f014124cea","repo":"remotion-dev/remotion","slug":"the-studio-canvas-is-not-ready-to-be-measured","errorCode":null,"errorMessage":"The Studio canvas is not ready to be measured.","messagePattern":"The Studio canvas is not ready to be measured\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/studio/src/components/WebMcp.tsx","lineNumber":1126,"sourceCode":"\t\t\t\t\t\t\tcompositions: compositionsRef.current,\n\t\t\t\t\t\t\ttimelinePosition: currentFrame,\n\t\t\t\t\t\t});\n\t\t\t\t\t\tconst portalNode = Internals.portalNode();\n\t\t\t\t\t\tconst portalRect = portalNode.getBoundingClientRect();\n\t\t\t\t\t\tconst metadata = currentCompositionMetadataRef.current;\n\t\t\t\t\t\tconst compositionWidth =\n\t\t\t\t\t\t\tmetadata?.width ?? composition.width ?? portalNode.offsetWidth;\n\t\t\t\t\t\tconst compositionHeight =\n\t\t\t\t\t\t\tmetadata?.height ?? composition.height ?? portalNode.offsetHeight;\n\t\t\t\t\t\tconst scaleX = portalRect.width / compositionWidth;\n\t\t\t\t\t\tconst scaleY = portalRect.height / compositionHeight;\n\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t!Number.isFinite(scaleX) ||\n\t\t\t\t\t\t\tscaleX === 0 ||\n\t\t\t\t\t\t\t!Number.isFinite(scaleY) ||\n\t\t\t\t\t\t\tscaleY === 0\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tthrow new Error('The Studio canvas is not ready to be measured.');\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\tconst measuredOutlines = measureOutlineTargets(\n\t\t\t\t\t\t\tportalNode,\n\t\t\t\t\t\t\tselectableOutlines.map((outline) => {\n\t\t\t\t\t\t\t\tif (outline.sequence.refForOutline === null) {\n\t\t\t\t\t\t\t\t\tthrow new Error('Expected an outline ref.');\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\t\t\tkey: outline.key,\n\t\t\t\t\t\t\t\t\tref: outline.sequence.refForOutline,\n\t\t\t\t\t\t\t\t\tcrop: {left: 0, right: 0, top: 0, bottom: 0},\n\t\t\t\t\t\t\t\t\tincludeOutsideContainer: true,\n\t\t\t\t\t\t\t\t};\n\t\t\t\t\t\t\t}),\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst measurementsByKey = new Map(","sourceCodeStart":1108,"sourceCodeEnd":1144,"githubUrl":"https://github.com/remotion-dev/remotion/blob/b2f4e34732f3c6c222ea029413e22dc402218cd7/packages/studio/src/components/WebMcp.tsx#L1108-L1144","documentation":"Thrown by the Studio WebMcp canvas-outline measurement tool when the canvas scale factors (scaleX/scaleY) are non-finite or zero. This means the canvas DOM node exists but has not been laid out yet, so element outlines cannot be converted to canvas coordinates.","triggerScenarios":"Calling the MCP outline/measurement tool immediately after Studio loads, before the canvas has rendered; or when the canvas element is hidden (display:none) or has zero size.","commonSituations":"Agents invoking the outline tool during initial composition load, before switching compositions, or while the preview is not visible.","solutions":["Wait/retry until the canvas is mounted and has non-zero size","Ensure a composition is loaded and the preview area is visible before calling the tool"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"const canvas = document.querySelector('.RemotionCanvas');\nif (!canvas || canvas.clientWidth === 0) {\n  // wait for layout before calling the outline tool\n}","typeGuard":null,"tryCatchPattern":"try { await outlineTool(); } catch (e) { if (e.message.includes('not ready to be measured')) await wait(200).then(outlineTool); else throw e; }","preventionTips":["Only call measurement tools after the canvas has painted","Retry with a short delay when Studio just loaded"],"tags":["studio","mcp","canvas","layout"],"backgroundTag":"dom-not-ready","analyzedSha":"b2f4e34732f3c6c222ea029413e22dc402218cd7","analyzedAt":"2026-08-28T15:39:09.316Z","contentChangedAt":"2026-08-28T15:39:09.316Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}