{"record":{"id":"8c8318e3e1e2f429","repo":"bevyengine/bevy","slug":"pre-computed-size-of-viewport-not-available","errorCode":null,"errorMessage":"pre-computed size of viewport not available","messagePattern":"pre-computed size of viewport not available","errorType":"exception","errorClass":"ViewportConversionError","httpStatus":null,"severity":"error","filePath":"crates/bevy_camera/src/camera.rs","lineNumber":340,"sourceCode":"            sensor_height: 0.01866,\n        }\n    }\n}\n\n/// Error returned when a conversion between world-space and viewport-space coordinates fails.\n///\n/// See [`world_to_viewport`][Camera::world_to_viewport] and [`viewport_to_world`][Camera::viewport_to_world].\n#[derive(Debug, Eq, PartialEq, Copy, Clone, Error)]\npub enum ViewportConversionError {\n    /// The pre-computed size of the viewport was not available.\n    ///\n    /// This may be because the `Camera` was just created and `camera_system` has not been executed\n    /// yet, or because the [`RenderTarget`] is misconfigured in one of the following ways:\n    ///   - it references the [`PrimaryWindow`](RenderTarget::Window) when there is none,\n    ///   - it references a [`Window`](RenderTarget::Window) entity that doesn't exist or doesn't actually have a `Window` component,\n    ///   - it references an [`Image`](RenderTarget::Image) that doesn't exist (invalid handle),\n    ///   - it references a [`TextureView`](RenderTarget::TextureView) that doesn't exist (invalid handle).\n    #[error(\"pre-computed size of viewport not available\")]\n    NoViewportSize,\n    /// The computed coordinate was beyond the `Camera`'s near plane.\n    ///\n    /// Only applicable when converting from world-space to viewport-space.\n    #[error(\"computed coordinate beyond `Camera`'s near plane\")]\n    PastNearPlane,\n    /// The computed coordinate was beyond the `Camera`'s far plane.\n    ///\n    /// Only applicable when converting from world-space to viewport-space.\n    #[error(\"computed coordinate beyond `Camera`'s far plane\")]\n    PastFarPlane,\n    /// The Normalized Device Coordinates could not be computed because the `camera_transform`, the\n    /// `world_position`, or the projection matrix defined by [`Projection`](super::projection::Projection)\n    /// contained `NAN` (see [`world_to_ndc`][Camera::world_to_ndc] and [`ndc_to_world`][Camera::ndc_to_world]).\n    #[error(\"found NaN while computing NDC\")]\n    InvalidData,\n}\n","sourceCodeStart":322,"sourceCodeEnd":358,"githubUrl":"https://github.com/bevyengine/bevy/blob/396ca727080776bd313bb892423b7d94e03b81b4/crates/bevy_camera/src/camera.rs#L322-L358","documentation":"ViewportConversionError::NoViewportSize: the camera's cached viewport size (computed by camera_system) was not available when a world-to-viewport or viewport-to-world conversion was attempted. Happens for a freshly spawned camera before camera_system has run, or when the RenderTarget is misconfigured (missing window, invalid image/texture-view handle).","triggerScenarios":"Thrown at crates/bevy_camera/src/camera.rs:340 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run the conversion after camera_system has executed (e.g. in a system ordered after it)","Ensure the camera's RenderTarget references an existing window, image, or texture view","Check that the camera has a CameraOutput component / is active"],"exampleFix":null,"handlingStrategy":"type-guard","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"396ca727080776bd313bb892423b7d94e03b81b4","analyzedAt":"2026-08-20T16:12:39.808Z","contentChangedAt":"2026-08-20T16:12:39.808Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}