{"record":{"id":"3519cdea11f4989e","repo":"mrdoob/three.js","slug":"three-cubecamera-updatecoordinatesystem-invalid","errorCode":null,"errorMessage":"THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: ${coordinateSystem}","messagePattern":"THREE\\.CubeCamera\\.updateCoordinateSystem\\(\\): Invalid coordinate system: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/cameras/CubeCamera.js","lineNumber":157,"sourceCode":"\n\t\t\tcameraNX.up.set( 0, - 1, 0 );\n\t\t\tcameraNX.lookAt( 1, 0, 0 );\n\n\t\t\tcameraPY.up.set( 0, 0, 1 );\n\t\t\tcameraPY.lookAt( 0, 1, 0 );\n\n\t\t\tcameraNY.up.set( 0, 0, - 1 );\n\t\t\tcameraNY.lookAt( 0, - 1, 0 );\n\n\t\t\tcameraPZ.up.set( 0, - 1, 0 );\n\t\t\tcameraPZ.lookAt( 0, 0, 1 );\n\n\t\t\tcameraNZ.up.set( 0, - 1, 0 );\n\t\t\tcameraNZ.lookAt( 0, 0, - 1 );\n\n\t\t} else {\n\n\t\t\tthrow new Error( 'THREE.CubeCamera.updateCoordinateSystem(): Invalid coordinate system: ' + coordinateSystem );\n\n\t\t}\n\n\t\tfor ( const camera of cameras ) {\n\n\t\t\tthis.add( camera );\n\n\t\t\tcamera.updateMatrixWorld();\n\n\t\t}\n\n\t}\n\n\t/**\n\t * Calling this method will render the given scene with the given renderer\n\t * into the cube render target of the camera.\n\t *\n\t * @param {(Renderer|WebGLRenderer)} renderer - The renderer.","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/mrdoob/three.js/blob/da05705fa31f02710c19772a2aa70c7454807f0c/src/cameras/CubeCamera.js#L139-L175","documentation":"Thrown by CubeCamera.updateCoordinateSystem() when the active coordinate system is neither WebGLCoordinateSystem nor WebGPUCoordinateSystem. The method orients the six face cameras (PX/NX/PY/NY/PZ/NZ) differently for each system; an unknown value has no valid orientation preset. The value normally comes from renderer.coordinateSystem, set automatically when CubeCamera.update(renderer, scene) detects a change.","triggerScenarios":"Calling cubeCamera.update(renderer, scene) where renderer.coordinateSystem is null, undefined, or a custom value. Also manually invoking updateCoordinateSystem() after assigning cubeCamera.coordinateSystem to a non-standard constant, or passing a fake/mock renderer object whose coordinateSystem field is unset.","commonSituations":"Using a custom renderer abstraction that does not expose coordinateSystem. Passing a stub renderer in tests. Migrating between WebGL and WebGPU and leaving a stale/null coordinateSystem. Forking three.js and introducing a third coordinate system without extending this switch.","solutions":["Use a standard renderer: WebGLRenderer (WebGLCoordinateSystem) or WebGPURenderer (WebGPUCoordinateSystem) so renderer.coordinateSystem is always valid.","If you built a custom renderer, set its coordinateSystem property to either THREE.WebGLCoordinateSystem or THREE.WebGPUCoordinateSystem before calling cubeCamera.update().","In tests, ensure the mock renderer exposes a valid coordinateSystem field rather than leaving it undefined.","Avoid manually assigning cubeCamera.coordinateSystem to arbitrary integers; let CubeCamera.update() sync it from the renderer."],"exampleFix":"// before: custom renderer with no coordinateSystem\ncubeCamera.update(myRenderer, scene); // myRenderer.coordinateSystem === undefined\n\n// after: expose a valid coordinate system on the renderer\nmyRenderer.coordinateSystem = THREE.WebGLCoordinateSystem;\ncubeCamera.update(myRenderer, scene);","handlingStrategy":"validation","validationCode":"import { WebGLCoordinateSystem, WebGPUCoordinateSystem } from 'three';\n\nfunction assertCoordinateSystem(renderer) {\n  const cs = renderer.coordinateSystem;\n  if (cs !== WebGLCoordinateSystem && cs !== WebGPUCoordinateSystem) {\n    throw new Error(`renderer.coordinateSystem must be WebGL/WebGPU, got ${cs}`);\n  }\n}\n\n// before rendering with a CubeCamera\nassertCoordinateSystem(renderer);\ncubeCamera.update(renderer, scene);","typeGuard":"import { WebGLCoordinateSystem, WebGPUCoordinateSystem } from 'three';\n\nfunction hasValidCoordinateSystem(renderer) {\n  const cs = renderer && renderer.coordinateSystem;\n  return cs === WebGLCoordinateSystem || cs === WebGPUCoordinateSystem;\n}","tryCatchPattern":null,"preventionTips":["Always source coordinateSystem from a real WebGLRenderer or WebGPURenderer.","In tests, set mockRenderer.coordinateSystem to a valid constant before calling update().","Never manually assign cubeCamera.coordinateSystem to arbitrary integers."],"tags":["threejs","coordinate-system","cubecamera","webgl","webgpu","renderer"],"backgroundTag":null,"analyzedSha":"da05705fa31f02710c19772a2aa70c7454807f0c","analyzedAt":"2026-08-12T22:51:37.160Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}