{"record":{"id":"8109e877f70606c7","repo":"sickn33/agentic-awesome-skills","slug":"shader-compilation-failed-message","errorCode":null,"errorMessage":"Shader compilation failed: ${message}","messagePattern":"Shader compilation failed: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"skills/liuguang-banlan-ui/assets/starter/shared/spectral-field.js","lineNumber":219,"sourceCode":"        \"linear-gradient(\" + angle + \"deg, transparent 6%, \" +\n        hexToRgba(entry.srgbFallback, alpha * 0.35) + \" 28%, \" +\n        hexToRgba(entry.srgbFallback, alpha) + \" 48%, \" +\n        hexToRgba(entry.srgbFallback, alpha * 0.32) + \" 68%, transparent 90%)\"\n      );\n    });\n\n    layers.push(\"var(--app-canvas)\");\n    return layers.join(\", \");\n  }\n\n  function compileShader(gl, type, source) {\n    const shader = gl.createShader(type);\n    gl.shaderSource(shader, source);\n    gl.compileShader(shader);\n    if (!gl.getShaderParameter(shader, gl.COMPILE_STATUS)) {\n      const message = gl.getShaderInfoLog(shader);\n      gl.deleteShader(shader);\n      throw new Error(`Shader compilation failed: ${message}`);\n    }\n    return shader;\n  }\n\n  function createProgram(gl) {\n    const program = gl.createProgram();\n    gl.attachShader(program, compileShader(gl, gl.VERTEX_SHADER, VERTEX_SHADER));\n    gl.attachShader(program, compileShader(gl, gl.FRAGMENT_SHADER, FRAGMENT_SHADER));\n    gl.linkProgram(program);\n    if (!gl.getProgramParameter(program, gl.LINK_STATUS)) {\n      throw new Error(`Shader link failed: ${gl.getProgramInfoLog(program)}`);\n    }\n    return program;\n  }\n\n  function uniform(gl, program, name) {\n    return gl.getUniformLocation(program, name);\n  }","sourceCodeStart":201,"sourceCodeEnd":237,"githubUrl":"https://github.com/sickn33/agentic-awesome-skills/blob/58d857988fcfac6986206bca2b2fe223aa437e4b/skills/liuguang-banlan-ui/assets/starter/shared/spectral-field.js#L201-L237","documentation":"compileShader compiles GLSL source via WebGL and throws when gl.getShaderParameter(shader, gl.COMPILE_STATUS) is false, embedding the driver's info log. The shader object is deleted before throwing. Typical causes are GLSL syntax errors, undeclared identifiers, or WebGL2-only constructs in a WebGL1 (GLSL ES 1.00) pipeline.","triggerScenarios":"Editing VERTEX_SHADER/FRAGMENT_SHADER strings in spectral-field.js and introducing a syntax error; using #version 300 es, in/out, or texture() while the context is WebGL1; exceeding precision/uniform limits on low-end GPUs.","commonSituations":"Customizing the spectral-field shader for a theme; copy-pasting GLSL from a WebGL2 example into this WebGL1 pipeline; strict mobile GPU/WebView compilers.","solutions":["Read the info log in the message — it names the offending line inside the shader string","Use GLSL ES 1.00 syntax: attribute/varying/texture2D, precision mediump float, no #version directive","Check for template-literal interpolation that injected 'undefined' into the GLSL source","Validate edited shaders in a live WebGL sandbox (Spector.js capture) before shipping"],"exampleFix":"// before (WebGL2 syntax, WebGL1 context)\nconst FRAGMENT_SHADER = `#version 300 es\nout vec4 o; void main(){ o = vec4(1.0); }`;\n\n// after\nconst FRAGMENT_SHADER = `precision mediump float;\nvoid main(){ gl_FragColor = vec4(1.0); }`;","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { program = createProgram(gl); }\ncatch (e) {\n  if (/Shader compilation failed/.test(e.message)) { console.error(e.message); return useFallbackRenderer(canvas); }\n  throw e;\n}","preventionTips":["Stick to GLSL ES 1.00 for WebGL1 contexts","Test shader edits in a real browser before shipping","Avoid template-literal interpolation inside GLSL strings","Log getShaderInfoLog during development"],"tags":["webgl","glsl","shader","browser"],"backgroundTag":"shader-compilation-failed","analyzedSha":"58d857988fcfac6986206bca2b2fe223aa437e4b","analyzedAt":"2026-08-26T11:55:59.350Z","schemaVersion":2},"datasetVersion":"2026-08-26T14:46:13.012Z"}