{"record":{"id":"ec2bacb5a879cb68","repo":"louis-e/arnis","slug":"earth-has-no-pds-raster","errorCode":null,"errorMessage":"Earth has no PDS raster","messagePattern":"Earth has no PDS raster","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/elevation/providers/planetary.rs","lineNumber":97,"sourceCode":"        (self.lon_span * self.ppd as f64) as usize\n    }\n\n    /// File name for the tile whose band starts at `(lat_band_min, lon_band_min)`.\n    fn tile_name(&self, body: CelestialBody, lat_band_min: f64, lon_band_min: f64) -> String {\n        let lat_band_max = lat_band_min + self.lat_span;\n        match body {\n            // megt{max_lat}{n|s}{lon:03}hb.img, label is MAXIMUM_LATITUDE.\n            CelestialBody::Mars => {\n                let hemi = if lat_band_max >= 0.0 { 'n' } else { 's' };\n                format!(\n                    \"megt{:02}{hemi}{:03}hb.img\",\n                    lat_band_max.abs() as i32,\n                    lon_band_min as i32\n                )\n            }\n            // One global file, so the band arguments are always the full globe.\n            CelestialBody::Moon => \"ldem_128.img\".to_string(),\n            CelestialBody::Earth => unreachable!(\"Earth has no PDS raster\"),\n        }\n    }\n}\n\npub struct PlanetaryDem {\n    pub body: CelestialBody,\n}\n\nimpl ElevationProvider for PlanetaryDem {\n    fn name(&self) -> &'static str {\n        match self.body {\n            CelestialBody::Moon => \"lola\",\n            CelestialBody::Mars => \"mola\",\n            CelestialBody::Earth => \"planetary\",\n        }\n    }\n\n    fn coverage_bboxes(&self) -> Option<Vec<LLBBox>> {","sourceCodeStart":79,"sourceCodeEnd":115,"githubUrl":"https://github.com/louis-e/arnis/blob/34048924d9365795fb0d832e76140a3fbdc413d9/src/elevation/providers/planetary.rs#L79-L115","documentation":"tile_name returns the PDS raster filename for a given celestial body's elevation band. Only Mars (banded files) and the Moon (single ldem_128.img file) have PDS rasters; Earth elevation is handled by a different provider path, so reaching tile_name with CelestialBody::Earth is a logic error and the code asserts this with unreachable!. Hitting this panic means Earth data was routed into the planetary (PDS) DEM pipeline.","triggerScenarios":"Calling fetch_row on a PlanetaryDem whose body is CelestialBody::Earth; constructing a PlanetaryDem with body = Earth and then invoking any fetch path that resolves a PDS tile name.","commonSituations":"Config or body-selection code defaulting to Earth but instantiating the planetary provider instead of the Earth provider; a body enum parsed from user input ('earth') reaching the wrong provider; a dispatch table that lists Earth as supported for planetary DEMs.","solutions":["Use the Earth-specific elevation provider (e.g. the fixed-tile/SRTM path) instead of PlanetaryDem when body is Earth.","Add an explicit guard at PlanetaryDem construction that rejects CelestialBody::Earth with a clear error, so the failure surfaces at setup rather than mid-fetch.","Fix the body/provider dispatch so Earth requests never route to the PDS pipeline."],"exampleFix":"// before\nlet dem = PlanetaryDem { body: CelestialBody::Earth };\ndem.fetch_row(...); // panics: unreachable\n// after\nmatch body {\n    CelestialBody::Earth => earth_provider.fetch(...),\n    CelestialBody::Mars | CelestialBody::Moon => PlanetaryDem { body }.fetch_row(...),\n}","handlingStrategy":"validation","validationCode":"if dem.body === 'Earth') throw new Error('PlanetaryDem does not support Earth; use the Earth elevation provider');","typeGuard":"fn is_pds_supported(body: &CelestialBody) -> bool {\n    matches!(body, CelestialBody::Mars | CelestialBody::Moon)\n}","tryCatchPattern":"// Rust panic; guard upstream instead\nassert!(is_pds_supported(&dem.body), \"PlanetaryDem requires Mars or Moon\");\nlet row = dem.fetch_row(...);","preventionTips":["Route Earth requests to the Earth elevation provider at the dispatch layer","Reject unsupported bodies at provider construction, not at fetch time","Document which CelestialBody variants each provider supports"],"tags":["panic","unreachable","elevation","provider-dispatch"],"backgroundTag":"unsupported-provider-dispatch","analyzedSha":"34048924d9365795fb0d832e76140a3fbdc413d9","analyzedAt":"2026-09-03T14:05:17.283Z","contentChangedAt":"2026-09-03T14:05:17.283Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}