{"record":{"id":"90fa22dff6351730","repo":"mrdoob/three.js","slug":"three-renderer-compilecomputeasync-expects-a-c","errorCode":null,"errorMessage":"THREE.Renderer: .compileComputeAsync() expects a ComputeNode.","messagePattern":"THREE\\.Renderer: \\.compileComputeAsync\\(\\) expects a ComputeNode\\.","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/renderers/common/Renderer.js","lineNumber":1131,"sourceCode":"\t * phenomenon which is called \"shader compilation stutter\", which occurs when\n\t * rendering an object with a new shader for the first time.\n\t *\n\t * @async\n\t * @param {Node|Array<Node>} computeNodes - The compute node(s).\n\t * @param {onProgressCallback} [onProgress] - Executed while the compilation is in progress.\n\t * @return {Promise} A Promise that resolves when the compile has been finished.\n\t */\n\tasync compileComputeAsync( computeNodes, onProgress = null ) {\n\n\t\tif ( this._isDeviceLost === true ) return;\n\n\t\tif ( this._initialized === false ) await this.init();\n\n\t\tconst computeList = Array.isArray( computeNodes ) ? computeNodes : [ computeNodes ];\n\n\t\tif ( computeList.length === 0 || computeList.some( ( computeNode ) => computeNode === undefined || computeNode === null || computeNode.isComputeNode !== true ) ) {\n\n\t\t\tthrow new Error( 'THREE.Renderer: .compileComputeAsync() expects a ComputeNode.' );\n\n\t\t}\n\n\t\tconst total = computeList.length;\n\t\tlet loaded = 0;\n\n\t\t//\n\n\t\tconst pipelines = this._pipelines;\n\t\tconst bindings = this._bindings;\n\t\tconst nodes = this._nodes;\n\n\t\tfor ( const computeNode of computeList ) {\n\n\t\t\tif ( pipelines.has( computeNode ) === false ) {\n\n\t\t\t\tconst dispose = () => {\n","sourceCodeStart":1113,"sourceCodeEnd":1149,"githubUrl":"https://github.com/mrdoob/three.js/blob/da05705fa31f02710c19772a2aa70c7454807f0c/src/renderers/common/Renderer.js#L1113-L1149","documentation":"Thrown by Renderer.compileComputeAsync() when the computeNodes argument is not a ComputeNode (or an array of them). The method accepts a single ComputeNode or an array, but every element must be a non-null object with isComputeNode === true; undefined/null/non-ComputeNode values are rejected.","triggerScenarios":"Passing a NodeMaterial, a compute pipeline object, undefined, null, or a plain object to compileComputeAsync; passing an array that contains a null/undefined element; referencing a compute node variable that was never assigned.","commonSituations":"Migrating from WebGLRenderer to the WebGPU/Nodes Renderer and confusing compute node APIs; passing the result of an async initializer that resolved to undefined; array filters that leave holes.","solutions":["Construct a ComputeNode via Fn/instancing or new THREE.ComputeNode(...) and pass that instance.","If passing an array, filter out null/undefined first: nodes.filter(n => n && n.isComputeNode).","Verify node && node.isComputeNode === true before calling compileComputeAsync.","Ensure the compute node import path matches your three.js version (Nodes API changed across releases)."],"exampleFix":"// before\nawait renderer.compileComputeAsync( computePipeline ); // not a ComputeNode\n\n// after\nimport { Fn, instanceIndex } from 'three/tsl';\nconst computeNode = Fn( () => { /* ... */ } ).compute( count );\nawait renderer.compileComputeAsync( computeNode );","handlingStrategy":"type-guard","validationCode":"const list = ( Array.isArray( computeNodes ) ? computeNodes : [ computeNodes ] )\n  .filter( n => n && n.isComputeNode === true );\nif ( list.length ) await renderer.compileComputeAsync( list );","typeGuard":"function isComputeNode( node ) {\n  return node != null && node.isComputeNode === true;\n}","tryCatchPattern":null,"preventionTips":["Construct nodes via TSL Fn(...).compute(count) or new THREE.ComputeNode.","Filter arrays to remove null/undefined before passing.","Verify node.isComputeNode === true before compile.","Ensure compute node imports match your three.js version."],"tags":["renderer","compute","nodes","type-guard","webgpu"],"backgroundTag":null,"analyzedSha":"da05705fa31f02710c19772a2aa70c7454807f0c","analyzedAt":"2026-08-12T22:51:37.160Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}