Migrating from r143 to r159 results in undefined (reading 'texture')

Hi, I ran into an issue migrating from r143 to r159.
The r159 console.log output helps a lot during migration and gives hints to most of the issues - great job guys!

But for some reason I ran into issues related to texture loading.
console.log output:
001/:3856 Uncaught TypeError: Cannot read properties of undefined (reading ‘texture’)
at render (001/:3856:43)
at init (001/:2929:5)
at 001/:1957:4
render @ 001/:3856
init @ 001/:2929
(anonymous) @ 001/:1957

I’ve checked the code and the manual but can’t find the issue. Clearly I must missed some very important point.
But I’ve been able to narrow it down to:
cubeMap = generatedCubeRenderTarget.texture;

If I remove for testing purpose the section ‘.texture’ it results in the following errors (repeating error loop)three.module.js:
1692 Uncaught TypeError: Cannot read properties of undefined (reading ‘primaries’)
at Object.getPrimaries (three.module.js:1692:37)
at getEncodingComponents (three.module.js:19387:44)
at getTexelEncodingFunction (three.module.js:19449:21)
at new WebGLProgram (three.module.js:20171:4)
at Object.acquireProgram (three.module.js:21132:14)
at getProgram (three.module.js:30008:28)
at setProgram (three.module.js:30253:15)
at WebGLRenderer.renderBufferDirect (three.module.js:29147:20)
at renderObject (three.module.js:29945:11)
at renderObjects (three.module.js:29914:6)

  1. How to find out what’s the problem, does three.js offer any advanced debugging mode?

  2. It’s a long complicated script - I’m not allowed to share it in full but will do my best to gather all needed debugs (just don’t know how - to be honest).

Update: I’ve checked all file permissions (texture-files, three.js script) - all set, should work (it does work with the r143 within the same setup *prior migration-changes)

Any help/tip would be an early x-mas for myself - thanks in advanced.

The best approach to debugging this would be to set a breakpoint at the line throwing the error (three.module.js:1692) in Chrome Dev Tools (or your browser of choice), or configure it to pause on the next uncaught error. Then you’ll be able to step up/down the call stack and see more specifically what’s happening.

Taking a guess though, perhaps some texture’s .encoding or .colorSpace property has been deleted — they aren’t supposed to be null or undefined. three.js r152 had some relevant changes described in Updates to Color Management in three.js r152. Assigning texture.colorSpace on whatever texture this is might fix the error. If it’s an HDR texture (.hdr or .exr for example) then you probably want THREE.LinearSRGBColorSpace. If it’s a non-HDR cubemap then you probably want THREE.SRGBColorSpace; If it’s not color data at all (normalMap, aoMap) then THREE.NoColorSpace.

thanks for pointing it out. Checked the colorspaces and encodings accordingly to r159.
I will debug my way deeper…

will stick to the r149 for now, until all other “issues” have been resolved.
Thanks again, great forum.