{"record":{"id":"15594fe33acec466","repo":"BabylonJS/Babylon.js","slug":"unknown-kind-kind-15594f","errorCode":null,"errorMessage":"Unknown kind: ${kind}","messagePattern":"Unknown kind: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"packages/dev/serializers/src/glTF/2.0/glTFUtilities.ts","lineNumber":145,"sourceCode":"        case VertexBuffer.UV3Kind:\r\n            return \"TEXCOORD_2\";\r\n        case VertexBuffer.UV4Kind:\r\n            return \"TEXCOORD_3\";\r\n        case VertexBuffer.UV5Kind:\r\n            return \"TEXCOORD_4\";\r\n        case VertexBuffer.UV6Kind:\r\n            return \"TEXCOORD_5\";\r\n        case VertexBuffer.MatricesIndicesKind:\r\n            return \"JOINTS_0\";\r\n        case VertexBuffer.MatricesIndicesExtraKind:\r\n            return \"JOINTS_1\";\r\n        case VertexBuffer.MatricesWeightsKind:\r\n            return \"WEIGHTS_0\";\r\n        case VertexBuffer.MatricesWeightsExtraKind:\r\n            return \"WEIGHTS_1\";\r\n    }\r\n\r\n    throw new Error(`Unknown kind: ${kind}`);\r\n}\r\n\r\nexport function GetPrimitiveMode(fillMode: number): MeshPrimitiveMode {\r\n    switch (fillMode) {\r\n        case Material.TriangleFillMode:\r\n            return MeshPrimitiveMode.TRIANGLES;\r\n        case Material.TriangleStripDrawMode:\r\n            return MeshPrimitiveMode.TRIANGLE_STRIP;\r\n        case Material.TriangleFanDrawMode:\r\n            return MeshPrimitiveMode.TRIANGLE_FAN;\r\n        case Material.PointListDrawMode:\r\n        case Material.PointFillMode:\r\n            return MeshPrimitiveMode.POINTS;\r\n        case Material.LineLoopDrawMode:\r\n            return MeshPrimitiveMode.LINE_LOOP;\r\n        case Material.LineListDrawMode:\r\n            return MeshPrimitiveMode.LINES;\r\n        case Material.LineStripDrawMode:\r","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/BabylonJS/Babylon.js/blob/0592b347b8a4ee0236089ea86a749cacfdb266d8/packages/dev/serializers/src/glTF/2.0/glTFUtilities.ts#L127-L163","documentation":"GetAttributeType maps a Babylon VertexBuffer kind to its glTF attribute name (POSITION, NORMAL, TEXCOORD_0, WEIGHTS_0, ...). Unknown kinds have no glTF attribute equivalent, so the function throws instead of emitting an invalid attribute name that glTF validators would reject.","triggerScenarios":"_exportVertexBuffer encounters a mesh vertex buffer whose kind is not in the switch (custom attribute kinds like 'myattr', misspelled kinds, or kinds introduced by newer engine code not yet mapped) during GLTFExporter export.","commonSituations":"Custom shader attributes added via mesh.setVerticesBuffer with arbitrary kind strings; typos in kind names; serializer lagging behind new VertexBuffer kinds added in the engine.","solutions":["Use only standard VertexBuffer kinds for attributes that must be exported, or strip custom buffers before export","Patch GetAttributeType to translate custom kinds to glTF custom attribute names (e.g. '_MYATTR') and extend GetAccessorType accordingly","Rename a typo'd kind to the correct VertexBuffer constant (e.g. VertexBuffer.UVKind) when creating the buffer","Catch the error and skip non-exportable attributes"],"exampleFix":"// before\nmesh.setVerticesBuffer(new VertexBuffer(engine, data, \"position2\", true));\n// after\nmesh.setVerticesBuffer(new VertexBuffer(engine, data, VertexBuffer.PositionKind, true)); // maps to \"POSITION\"","handlingStrategy":"type-guard","validationCode":"const EXPORTABLE_KINDS = new Set(Object.values(VertexBuffer).filter((v) => typeof v === \"string\"));\nconst canMapToAttribute = (kind: string): boolean => EXPORTABLE_KINDS.has(kind);","typeGuard":"const isStandardKind = (kind: string): boolean =>\n    [VertexBuffer.PositionKind, VertexBuffer.NormalKind, VertexBuffer.UVKind, VertexBuffer.MatricesWeightsKind].includes(kind);","tryCatchPattern":"try {\n    await GLTF2Export.GLTFAsync(scene, \"scene\");\n} catch (e) {\n    if (e instanceof Error && e.message.startsWith(\"Unknown kind:\")) {\n        // remove/rename the offending vertex buffer and retry the export\n    } else { throw e; }\n}","preventionTips":["Always reference kinds via VertexBuffer constants to prevent spelling drift","Audit custom attributes added via setVerticesBuffer before any glTF export","Keep the serializer's kind-to-attribute table in sync with engine VertexBuffer kinds","Write a smoke test exporting a mesh containing every kind your project uses"],"tags":["gltf","export","vertex-buffer","attribute-mapping","serialization"],"backgroundTag":"unknown-vertex-attribute-kind","analyzedSha":"0592b347b8a4ee0236089ea86a749cacfdb266d8","analyzedAt":"2026-08-30T15:11:20.442Z","schemaVersion":2},"datasetVersion":"2026-08-30T18:17:15.746Z"}