{"record":{"id":"c1656fd151d4e861","repo":"BabylonJS/Babylon.js","slug":"unsupported-const-property-type-type","errorCode":null,"errorMessage":"`Unsupported const property type: '${type}'`","messagePattern":"`Unsupported const property type: '(.+?)'`","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/dev/smartFilters/src/utils/buildTools/shaderConverter.ts","lineNumber":240,"sourceCode":"            throw new Error(`Consts must have a name: '${constLine}'`);\r\n        }\r\n        if (defaultValue === null) {\r\n            throw new Error(`Consts must have a value: '${constLine}'`);\r\n        }\r\n\r\n        const constProperty: ConstPropertyMetadata | null =\r\n            type === \"float\"\r\n                ? {\r\n                      name: DecorateSymbol(friendlyName),\r\n                      friendlyName,\r\n                      type,\r\n                      defaultValue: parseFloat(defaultValue),\r\n                      options: annotation.property.options as ConstMetadataAnnotationFloatOptions | undefined,\r\n                  }\r\n                : null;\r\n\r\n        if (!constProperty) {\r\n            throw new Error(`Unsupported const property type: '${type}'`);\r\n        }\r\n        fragmentConstProperties.push(constProperty);\r\n\r\n        // Strip out the definition from the code - it will be added back in when creating the runtime by the CustomShaderBlock\r\n        fragmentShader = fragmentShader.replace(annotationJSON, \"\");\r\n        fragmentShader = fragmentShader.replace(constLine, \"\");\r\n    }\r\n\r\n    const fragmentShaderWithNoFunctionBodies = RemoveFunctionBodies(fragmentShader);\r\n\r\n    // Collect uniform, const, and function names which need to be decorated\r\n    // eslint-disable-next-line prettier/prettier\r\n    const uniformNames = uniforms.map((uniform) => uniform.name);\r\n    log(`Uniforms found: ${JSON.stringify(uniforms)}`);\r\n    const consts = [...fragmentShader.matchAll(/\\S*const\\s+\\w*\\s+(\\w*)\\s*=.*;/g)].map((match) => match[1]);\r\n    log(`Consts found: ${JSON.stringify(consts)}`);\r\n    const constPropertyFriendlyNames = fragmentConstProperties.map((c) => c.friendlyName);\r\n    log(`Const properties found: ${JSON.stringify(constPropertyFriendlyNames)}`);\r","sourceCodeStart":222,"sourceCodeEnd":258,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/smartFilters/src/utils/buildTools/shaderConverter.ts#L222-L258","documentation":"The const line parsed successfully, but its type is not 'float'. The Smart Filters const-property system currently only exposes float consts as editable properties; any other type (vec2, vec3, int, bool, etc.) makes constProperty null and triggers this error. The type name is included in the message.","triggerScenarios":"ParseFragmentShader on an annotated const such as `// {\"property\":...}` followed by `const vec3 tint = ...;` or `const int steps = 4;` — any non-float type with a property annotation.","commonSituations":"Authors assuming vector consts can be exposed as color properties; converting existing shader library code where consts are vec types; docs older than the float-only restriction.","solutions":["Change the const type to float, or split vectors into individual float consts.","Remove the property annotation from non-float consts so they are kept as plain GLSL consts.","If a color/vector property is needed, use a uniform with the appropriate annotation instead of a const property."],"exampleFix":"// before\n// {\"property\": {\"type\": \"float\", \"options\": {\"min\":0,\"max\":1}}}\nconst vec3 tint = vec3(1.0, 0.5, 0.5);\n// after\nuniform vec3 tint; // {\"property\": {\"type\": \"color3\"}}\n// (or three float consts: tintR, tintG, tintB)","handlingStrategy":"validation","validationCode":"const annotatedConsts = [...shader.matchAll(/\\/\\/\\s*\\{.*\\}\\s*(?:\\r?\\n)+const\\s+(\\w+)/gm)].map(m => m[1]);\nconst bad = annotatedConsts.filter(t => t !== \"float\");\nif (bad.length) throw new Error(`Only float consts can be properties; found: ${bad.join(\", \")}`);","typeGuard":"function isFloatConst(type: string): type is \"float\" {\n  return type === \"float\";\n}","tryCatchPattern":"try {\n  const info = ParseFragmentShader(blockName, namespace, shader);\n} catch (e) {\n  if (e instanceof Error && e.message.startsWith(\"Unsupported const property type\")) {\n    // convert to float consts or a uniform property, then retry\n  } else throw e;\n}","preventionTips":["Only annotate `float` consts as properties.","Expose vectors/colors via uniform properties instead of consts.","Document the float-only restriction in your shader-authoring guide."],"tags":["shader","parsing","glsl","type-error"],"backgroundTag":"unsupported-shader-property-type","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}