{"record":{"id":"87b765b4e2afd5fe","repo":"BabylonJS/Babylon.js","slug":"uniforms-must-have-a-name-uniformline","errorCode":null,"errorMessage":"`Uniforms must have a name: '${uniformLine}'`","messagePattern":"`Uniforms must have a name: '(.+?)'`","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/smartFilters/src/utils/buildTools/shaderConverter.ts","lineNumber":148,"sourceCode":"        const annotationJSON = matches[1];\r\n        const uniformLine = matches[2];\r\n\r\n        if (!uniformLine) {\r\n            throw new Error(\"Uniform line not found\");\r\n        }\r\n\r\n        const uniformLineMatches = new RegExp(/^uniform\\s+(\\w+)\\s+(\\w+)\\s*;?/gm).exec(uniformLine);\r\n        if (!uniformLineMatches || uniformLineMatches.length < 3) {\r\n            throw new Error(`Uniforms must have a type and a name: '${uniformLine}'`);\r\n        }\r\n        const uniformTypeString = uniformLineMatches[1];\r\n        const uniformName = uniformLineMatches[2];\r\n\r\n        if (!uniformTypeString) {\r\n            throw new Error(`Uniforms must have a type: '${uniformLine}'`);\r\n        }\r\n        if (!uniformName) {\r\n            throw new Error(`Uniforms must have a name: '${uniformLine}'`);\r\n        }\r\n\r\n        // Convert to ConnectionPointType\r\n        let type: ConnectionPointType;\r\n        switch (uniformTypeString) {\r\n            case \"float\":\r\n                type = ConnectionPointType.Float;\r\n                break;\r\n            case \"sampler2D\":\r\n                type = ConnectionPointType.Texture;\r\n                break;\r\n            case \"vec3\":\r\n                type = ConnectionPointType.Color3;\r\n                break;\r\n            case \"vec4\":\r\n                type = ConnectionPointType.Color4;\r\n                break;\r\n            case \"bool\":\r","sourceCodeStart":130,"sourceCodeEnd":166,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/smartFilters/src/utils/buildTools/shaderConverter.ts#L130-L166","documentation":"Symmetric to the type check: the regex matched but the name capture group is empty, so the uniform has a type but no recognizable name. The tool cannot create a named uniform/connection point without it.","triggerScenarios":"A declaration like 'uniform float;' or trailing characters that stop the (\\w+) name capture from matching.","commonSituations":"Incomplete declarations after editing; accidentally deleting a uniform's name; template generation bugs producing nameless uniforms.","solutions":["Add an identifier name to the uniform declaration.","Verify each uniform line follows 'uniform <type> <name>;' exactly.","Check the echoed line in the error message to locate the broken statement."],"exampleFix":"// before\nuniform float;\n// after\nuniform float opacity;","handlingStrategy":"validation","validationCode":"src.split('\\n').forEach((l, i) => { const m = l.trim().match(/^uniform\\s+(\\w+)\\s+(\\w+)\\s*;?$/); if (l.trim().startsWith('uniform') && (!m || !m[2])) console.error(`Uniform missing name at line ${i+1}`); });","typeGuard":null,"tryCatchPattern":"try { await ConvertShader(path, ...); } catch (e) { const m = e.message.match(/Uniforms must have a name: '(.*)'/); if (m) { addUniformName(m[1]); } else { throw e; } }","preventionTips":["Always name every uniform.","Avoid half-finished declarations in committed shaders.","Review shader diffs for dropped identifiers."],"tags":["glsl","uniform-parsing","syntax"],"backgroundTag":"uniform-name-missing","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}