BabylonJS/Babylon.js · error
Unknown kind: ${kind}
Error message
Unknown kind: ${kind} What it means
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.
Source
Thrown at packages/dev/serializers/src/glTF/2.0/glTFUtilities.ts:145
case VertexBuffer.UV3Kind:
return "TEXCOORD_2";
case VertexBuffer.UV4Kind:
return "TEXCOORD_3";
case VertexBuffer.UV5Kind:
return "TEXCOORD_4";
case VertexBuffer.UV6Kind:
return "TEXCOORD_5";
case VertexBuffer.MatricesIndicesKind:
return "JOINTS_0";
case VertexBuffer.MatricesIndicesExtraKind:
return "JOINTS_1";
case VertexBuffer.MatricesWeightsKind:
return "WEIGHTS_0";
case VertexBuffer.MatricesWeightsExtraKind:
return "WEIGHTS_1";
}
throw new Error(`Unknown kind: ${kind}`);
}
export function GetPrimitiveMode(fillMode: number): MeshPrimitiveMode {
switch (fillMode) {
case Material.TriangleFillMode:
return MeshPrimitiveMode.TRIANGLES;
case Material.TriangleStripDrawMode:
return MeshPrimitiveMode.TRIANGLE_STRIP;
case Material.TriangleFanDrawMode:
return MeshPrimitiveMode.TRIANGLE_FAN;
case Material.PointListDrawMode:
case Material.PointFillMode:
return MeshPrimitiveMode.POINTS;
case Material.LineLoopDrawMode:
return MeshPrimitiveMode.LINE_LOOP;
case Material.LineListDrawMode:
return MeshPrimitiveMode.LINES;
case Material.LineStripDrawMode:
View on GitHub (pinned to 0592b347b8)
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
Example fix
// before mesh.setVerticesBuffer(new VertexBuffer(engine, data, "position2", true)); // after mesh.setVerticesBuffer(new VertexBuffer(engine, data, VertexBuffer.PositionKind, true)); // maps to "POSITION"
Defensive patterns
Strategy: type-guard
Validate before calling
const EXPORTABLE_KINDS = new Set(Object.values(VertexBuffer).filter((v) => typeof v === "string")); const canMapToAttribute = (kind: string): boolean => EXPORTABLE_KINDS.has(kind);
Type guard
const isStandardKind = (kind: string): boolean =>
[VertexBuffer.PositionKind, VertexBuffer.NormalKind, VertexBuffer.UVKind, VertexBuffer.MatricesWeightsKind].includes(kind); Try / catch
try {
await GLTF2Export.GLTFAsync(scene, "scene");
} catch (e) {
if (e instanceof Error && e.message.startsWith("Unknown kind:")) {
// remove/rename the offending vertex buffer and retry the export
} else { throw e; }
} Prevention
- 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
When it happens
Trigger: _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.
Common situations: 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.
Related errors
- Unknown kind ${kind}
- Vertex buffers pointing to the same buffer must have the sam
- Buffer data is not available
- Triangle strip/fan fill mode is not implemented
- Unknown fill mode: ${fillMode}
AI-assisted analysis of BabylonJS/Babylon.js@0592b347b8 (2026-08-30).
Data as JSON: /api/errors/15594fe33acec466.
Report an issue: GitHub.