{"record":{"id":"94bc2040e318505d","repo":"remotion-dev/remotion","slug":"failed-to-acquire-2d-context-for-color-parsing-94bc20","errorCode":null,"errorMessage":"Failed to acquire 2D context for color parsing","messagePattern":"Failed to acquire 2D context for color parsing","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/effects/src/drop-shadow/drop-shadow-runtime.ts","lineNumber":204,"sourceCode":"\tgl.vertexAttribPointer(1, 2, gl.FLOAT, false, 16, 8);\n\n\tgl.bindVertexArray(null);\n\n\tconst textureSource = createRgbaTexture(gl);\n\tconst textureShadowA = createRgbaTexture(gl);\n\tconst textureShadowB = createRgbaTexture(gl);\n\n\tconst framebuffer = gl.createFramebuffer();\n\tif (!framebuffer) {\n\t\tthrow new Error('Failed to create WebGL framebuffer');\n\t}\n\n\tconst colorCanvas = document.createElement('canvas');\n\tcolorCanvas.width = 1;\n\tcolorCanvas.height = 1;\n\tconst colorCtx = colorCanvas.getContext('2d', {willReadFrequently: true});\n\tif (!colorCtx) {\n\t\tthrow new Error('Failed to acquire 2D context for color parsing');\n\t}\n\n\treturn {\n\t\tgl,\n\t\tprogramExtract,\n\t\tprogramHorizontal,\n\t\tprogramVertical,\n\t\tprogramComposite,\n\t\tvao,\n\t\tvbo,\n\t\ttextureSource,\n\t\ttextureShadowA,\n\t\ttextureShadowB,\n\t\tframebuffer,\n\t\textract: {\n\t\t\tuSource: gl.getUniformLocation(programExtract, 'uSource'),\n\t\t\tuColor: gl.getUniformLocation(programExtract, 'uColor'),\n\t\t\tuOpacity: gl.getUniformLocation(programExtract, 'uOpacity'),","sourceCodeStart":186,"sourceCodeEnd":222,"githubUrl":"https://github.com/remotion-dev/remotion/blob/78fe4bb3fdb5a2cd68724393d63cb223db333fa7/packages/effects/src/drop-shadow/drop-shadow-runtime.ts#L186-L222","documentation":"Thrown by setupDropShadow when an offscreen 1x1 canvas's getContext('2d', {willReadFrequently: true}) returns null. The drop-shadow runtime uses this 2D context to parse the user's CSS color string into RGBA via the browser's color parser. A null 2D context is rare and typically signals an environment where 2D canvas acceleration is unavailable or the browser denied the context.","triggerScenarios":"The browser cannot provide a 2D canvas context for the tiny offscreen color-parsing canvas — usually because canvas contexts are exhausted, the page is in a degraded GPU mode, or the runtime is a non-browser environment without full Canvas2D support. Reached at the very end of setupDropShadow().","commonSituations":"Headless environments with limited canvas support; browser extensions blocking canvas; very high canvas-context counts; old browsers; some embedded webviews.","solutions":["Reduce total canvas usage on the page to free a 2D context slot.","Update the browser / webview to a version with full Canvas2D support.","Disable browser extensions that block canvas reading and reload.","For headless rendering, ensure Chromium runs with GPU/software canvas enabled (not disabled).","Report a Remotion issue if it reproduces in a stock desktop browser."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"const canvas2dAvailable = () => {\n  try {\n    return !!document.createElement('canvas').getContext('2d');\n  } catch {\n    return false;\n  }\n};\n\nif (!canvas2dAvailable()) {\n  // omit drop-shadow() or pre-parse the color yourself and bypass the effect","typeGuard":null,"tryCatchPattern":"try {\n  state = setupDropShadow(canvas);\n} catch (err) {\n  if (err instanceof Error && /2D context/i.test(err.message)) {\n    console.error('Canvas 2D unavailable for drop-shadow color parsing:', err.message);\n    // fall back to a CSS box-shadow layer\n  } else {\n    throw err;\n  }\n}","preventionTips":["Reduce total canvas usage on the page to free a 2D context slot.","Disable canvas-blocking browser extensions and retest.","Use a current browser/webview with full Canvas2D support; verify headless Chromium is not run with canvas disabled."],"tags":["webgl2","drop-shadow","canvas2d","color-parsing","runtime","environment"],"backgroundTag":null,"analyzedSha":"78fe4bb3fdb5a2cd68724393d63cb223db333fa7","analyzedAt":"2026-08-12T17:18:50.444Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}