{"record":{"id":"03b4375864a541bd","repo":"mrdoob/three.js","slug":"three-camerahelper-update-invalid-coordinate-sy","errorCode":null,"errorMessage":"THREE.CameraHelper.update(): Invalid coordinate system: ${this.camera.coordinateSystem}","messagePattern":"THREE\\.CameraHelper\\.update\\(\\): Invalid coordinate system: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/helpers/CameraHelper.js","lineNumber":264,"sourceCode":"\n\t\t\tnearZ = 1;\n\t\t\tfarZ = 0;\n\n\t\t} else {\n\n\t\t\tif ( this.camera.coordinateSystem === WebGLCoordinateSystem ) {\n\n\t\t\t\tnearZ = - 1;\n\t\t\t\tfarZ = 1;\n\n\t\t\t} else if ( this.camera.coordinateSystem === WebGPUCoordinateSystem ) {\n\n\t\t\t\tnearZ = 0;\n\t\t\t\tfarZ = 1;\n\n\t\t\t} else {\n\n\t\t\t\tthrow new Error( 'THREE.CameraHelper.update(): Invalid coordinate system: ' + this.camera.coordinateSystem );\n\n\t\t\t}\n\n\t\t}\n\n\n\t\t// center / target\n\t\tsetPoint( 'c', pointMap, geometry, _camera, 0, 0, nearZ );\n\t\tsetPoint( 't', pointMap, geometry, _camera, 0, 0, farZ );\n\n\t\t// near\n\n\t\tsetPoint( 'n1', pointMap, geometry, _camera, - w, - h, nearZ );\n\t\tsetPoint( 'n2', pointMap, geometry, _camera, w, - h, nearZ );\n\t\tsetPoint( 'n3', pointMap, geometry, _camera, - w, h, nearZ );\n\t\tsetPoint( 'n4', pointMap, geometry, _camera, w, h, nearZ );\n\n\t\t// far","sourceCodeStart":246,"sourceCodeEnd":282,"githubUrl":"https://github.com/mrdoob/three.js/blob/da05705fa31f02710c19772a2aa70c7454807f0c/src/helpers/CameraHelper.js#L246-L282","documentation":"Thrown by CameraHelper.update() when the camera being visualized has a coordinateSystem that is neither WebGLCoordinateSystem nor WebGPUCoordinateSystem. The helper picks nearZ/farZ clip-space values (e.g. -1..1 for WebGL, 0..1 for WebGPU) to draw the frustum correctly; without a recognized system the helper cannot place those points.","triggerScenarios":"Constructing new THREE.CameraHelper(camera) where camera.coordinateSystem is null/undefined or a custom value, then the helper runs its update. Using a Camera subclass whose coordinateSystem was never set by a renderer. Passing a raw Camera (not a PerspectiveCamera produced alongside a renderer) whose coordinateSystem defaults to null.","commonSituations":"Inspecting a frustum for a camera that has never been used with a real renderer. Mixing a WebGPU projection matrix convention with a camera flagged as WebGL, or vice versa. Custom camera subclasses that don't propagate coordinateSystem.","solutions":["Ensure the camera's coordinateSystem is set to a valid constant before constructing/updating CameraHelper: camera.coordinateSystem = THREE.WebGLCoordinateSystem (or WebGPUCoordinateSystem).","Run the camera through a standard renderer at least once so its coordinateSystem is populated, then create the CameraHelper.","If you built a custom camera class, expose and set coordinateSystem explicitly.","Match the camera's coordinateSystem to whatever renderer/projection convention you actually use."],"exampleFix":"// before: bare camera, coordinateSystem is null\nconst helper = new THREE.CameraHelper(cam);\n\n// after: set the coordinate system explicitly\ncam.coordinateSystem = THREE.WebGLCoordinateSystem;\nconst helper = new THREE.CameraHelper(cam);","handlingStrategy":"validation","validationCode":"import { WebGLCoordinateSystem, WebGPUCoordinateSystem } from 'three';\n\nfunction ensureCameraCoordinateSystem(camera, fallback = WebGLCoordinateSystem) {\n  const cs = camera.coordinateSystem;\n  if (cs !== WebGLCoordinateSystem && cs !== WebGPUCoordinateSystem) {\n    camera.coordinateSystem = fallback;\n  }\n  return camera;\n}\n\nensureCameraCoordinateSystem(cam);\nconst helper = new THREE.CameraHelper(cam);","typeGuard":"function hasValidCoordinateSystem(camera) {\n  const cs = camera && camera.coordinateSystem;\n  return cs === THREE.WebGLCoordinateSystem || cs === THREE.WebGPUCoordinateSystem;\n}","tryCatchPattern":null,"preventionTips":["Run a camera through its renderer before visualizing it with CameraHelper.","Set camera.coordinateSystem explicitly in custom camera subclasses.","Keep the camera's coordinateSystem consistent with the renderer's depth convention."],"tags":["threejs","coordinate-system","camerahelper","frustum","debug-helper"],"backgroundTag":null,"analyzedSha":"da05705fa31f02710c19772a2aa70c7454807f0c","analyzedAt":"2026-08-12T22:51:37.160Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}