mrdoob/three.js · error

THREE.NodeUtils: Unsupported type: ${type}

Error message

THREE.NodeUtils: Unsupported type: ${type}

What it means

Thrown by NodeUtils.getTypedArrayFromType() when the type string does not match vec/ivec/uvec, mat, float, uint, or int patterns. The function picks the JS typed array (Float32Array/Int32Array/Uint32Array) backing a node's data, so an unrecognized type has no array representation.

Source

Thrown at src/nodes/core/NodeUtils.js:151

		// Handle int vectors
		if ( type.startsWith( 'ivec' ) ) return Int32Array;
		// Handle uint vectors
		if ( type.startsWith( 'uvec' ) ) return Uint32Array;
		// Default to float vectors
		return Float32Array;

	}

	// Handle matrices (always float)
	if ( /mat\d/.test( type ) ) return Float32Array;

	// Basic types
	if ( /float/.test( type ) ) return Float32Array;
	if ( /uint/.test( type ) ) return Uint32Array;
	if ( /int/.test( type ) ) return Int32Array;

	throw new Error( `THREE.NodeUtils: Unsupported type: ${type}` );

}

/**
 * Returns the length for the given data type.
 *
 * @private
 * @method
 * @param {string} type - The data type.
 * @return {number} The length.
 */
export function getLengthFromType( type ) {

	if ( /float|int|uint|bool/.test( type ) ) return 1;
	if ( /vec2/.test( type ) ) return 2;
	if ( /vec3/.test( type ) ) return 3;
	if ( /vec4/.test( type ) ) return 4;
	if ( /mat2/.test( type ) ) return 4;

View on GitHub (pinned to da05705fa3)

Solutions

  1. Use a recognized primitive type string (float, int, uint, vecN, ivecN, uvecN, matN).
  2. Fix the upstream node so getNodeType() returns a valid type instead of null/empty/custom.
  3. For boolean/struct data, encode it as uint/int.
Defensive patterns

Strategy: validation

Validate before calling

function resolveTypedArray( type ) {
  if ( /[iu]?vec\d/.test( type ) ) return type.startsWith( 'ivec' ) ? Int32Array : type.startsWith( 'uvec' ) ? Uint32Array : Float32Array;
  if ( /mat\d/.test( type ) ) return Float32Array;
  if ( /float/.test( type ) ) return Float32Array;
  if ( /uint/.test( type ) ) return Uint32Array;
  if ( /int/.test( type ) ) return Int32Array;
  throw new TypeError( `Unsupported type: ${ type }` );
}

Type guard

const isResolvableArrayType = ( t ) => /[iu]?vec\d|mat\d|float|uint|int/.test( t );

Prevention

When it happens

Trigger: Passing a type like 'bool', a struct name, an array type, an empty string, or a custom type string to code that resolves a typed array; a node reporting an unregistered type during buffer/attribute allocation.

Common situations: Custom node types not following the vec/mat/scalar naming convention; corrupt or empty type strings from failed type inference; older/newer type naming mismatch across versions.

Related errors


AI-assisted analysis of mrdoob/three.js@da05705fa3 (2026-08-12). Data as JSON: /api/errors/795e135653b8ea50. Report an issue: GitHub.