diff --git a/hescorehpxml/__init__.py b/hescorehpxml/__init__.py
index 55a58b86..e7bfb5c8 100644
--- a/hescorehpxml/__init__.py
+++ b/hescorehpxml/__init__.py
@@ -1345,7 +1345,7 @@ class HPXMLtoHEScoreTranslator(object):
             elif zone_floor['foundation_type'] == 'slab_on_grade':
                 del fw_eff_rvalues[11]  # remove unused values
                 del fw_eff_rvalues[19]
-                slabs = foundation.xpath('h:Slab', namespaces=ns)
+                slabs = xpath(foundation, 'h:Slab', raise_err=True, aslist=True)
                 slabua = 0
                 slabtotalperimeter = 0
                 for slab in slabs:

Throw descriptive error message on SlabOnGrade foundations when a Slab element is missing
Currently, when foundations are defined without attaching a slab element, translator will throw an error of "integer division or modulo by zero". A more descriptive error is expected to reflect the missing input.
Might be a sub-issue of #106 .
diff --git a/tests/tests.py b/tests/tests.py
index 1f6fd6cb..60924139 100644
--- a/tests/tests.py
+++ b/tests/tests.py
@@ -320,6 +320,15 @@ class TestOtherHouses(unittest.TestCase, ComparatorBase):
                                 r'The house is a slab on grade foundation, but has foundation walls\.',
                                 tr.hpxml_to_hescore_dict)
 
+    def test_slab_missing(self):
+        tr = self._load_xmlfile('house3')
+        el = self.xpath('//h:Slab')
+        el.getparent().remove(el)
+        self.assertRaises(
+            ElementNotFoundError,
+            tr.hpxml_to_hescore_dict
+        )
+
     def test_missing_window_area(self):
         tr = self._load_xmlfile('hescore_min')
         el = self.xpath('//h:Window[1]/h:Area')

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest pytest-cov pytest-xdist pytest-mock pytest-asyncio
apt-get update apt-get install -y gcc
3.7
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.13
Babel==2.14.0
certifi @ file:///croot/certifi_1671487769961/work/certifi
charset-normalizer==3.4.1
colorama==0.4.6
coverage==7.2.7
docutils==0.17.1
exceptiongroup==1.2.2
execnet==2.0.2
flake8==5.0.4
future==1.0.0
-e git+https://github.com/NREL/hescore-hpxml.git@0b79d17c5fff0876a18ccd2efca3d058323d7810#egg=hescore_hpxml
idna==3.10
imagesize==1.4.1
importlib-metadata==4.2.0
iniconfig==2.0.0
Jinja2==3.1.6
livereload==2.7.1
lxml==5.3.1
MarkupSafe==2.1.5
mccabe==0.7.0
packaging==24.0
pluggy==1.2.0
pycodestyle==2.9.1
pyflakes==2.5.0
Pygments==2.17.2
pytest==7.4.4
pytest-asyncio==0.21.2
pytest-cov==4.1.0
pytest-mock==3.11.1
pytest-xdist==3.5.0
pytz==2025.2
requests==2.31.0
snowballstemmer==2.2.0
Sphinx==4.3.2
sphinx-autobuild==2021.3.14
sphinx-rtd-theme==1.3.0
sphinxcontrib-applehelp==1.0.2
sphinxcontrib-devhelp==1.0.2
sphinxcontrib-htmlhelp==2.0.0
sphinxcontrib-jquery==4.1
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==1.0.3
sphinxcontrib-serializinghtml==1.1.5
tomli==2.0.1
tornado==6.2
typing_extensions==4.7.1
urllib3==2.0.7
zipp==3.15.0

name: hescore-hpxml
channels:
  - defaults
  - https://repo.anaconda.com/pkgs/main
  - https://repo.anaconda.com/pkgs/r
  - conda-forge
dependencies:
  - _libgcc_mutex=0.1=main
  - _openmp_mutex=5.1=1_gnu
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2022.12.7=py37h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.4.4=h6a678d5_1
  - libgcc-ng=11.2.0=h1234567_1
  - libgomp=11.2.0=h1234567_1
  - libstdcxx-ng=11.2.0=h1234567_1
  - ncurses=6.4=h6a678d5_0
  - openssl=1.1.1w=h7f8727e_0
  - pip=22.3.1=py37h06a4308_0
  - python=3.7.16=h7a1cb2a_0
  - readline=8.2=h5eee18b_0
  - setuptools=65.6.3=py37h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.38.4=py37h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.13
      - babel==2.14.0
      - charset-normalizer==3.4.1
      - colorama==0.4.6
      - coverage==7.2.7
      - docutils==0.17.1
      - exceptiongroup==1.2.2
      - execnet==2.0.2
      - flake8==5.0.4
      - future==1.0.0
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==4.2.0
      - iniconfig==2.0.0
      - jinja2==3.1.6
      - livereload==2.7.1
      - lxml==5.3.1
      - markupsafe==2.1.5
      - mccabe==0.7.0
      - packaging==24.0
      - pluggy==1.2.0
      - pycodestyle==2.9.1
      - pyflakes==2.5.0
      - pygments==2.17.2
      - pytest==7.4.4
      - pytest-asyncio==0.21.2
      - pytest-cov==4.1.0
      - pytest-mock==3.11.1
      - pytest-xdist==3.5.0
      - pytz==2025.2
      - requests==2.31.0
      - snowballstemmer==2.2.0
      - sphinx==4.3.2
      - sphinx-autobuild==2021.3.14
      - sphinx-rtd-theme==1.3.0
      - sphinxcontrib-applehelp==1.0.2
      - sphinxcontrib-devhelp==1.0.2
      - sphinxcontrib-htmlhelp==2.0.0
      - sphinxcontrib-jquery==4.1
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==1.0.3
      - sphinxcontrib-serializinghtml==1.1.5
      - tomli==2.0.1
      - tornado==6.2
      - typing-extensions==4.7.1
      - urllib3==2.0.7
      - zipp==3.15.0
prefix: /opt/conda/envs/hescore-hpxml

tests/tests.py::TestOtherHouses::test_slab_missing
tests/tests.py::TestAPIHouses::test_house1 tests/tests.py::TestAPIHouses::test_house1_v1_1 tests/tests.py::TestAPIHouses::test_house1_v2 tests/tests.py::TestAPIHouses::test_house1_v2_1 tests/tests.py::TestAPIHouses::test_house2 tests/tests.py::TestAPIHouses::test_house3 tests/tests.py::TestAPIHouses::test_house4 tests/tests.py::TestAPIHouses::test_house5 tests/tests.py::TestAPIHouses::test_house6 tests/tests.py::TestAPIHouses::test_house7 tests/tests.py::TestAPIHouses::test_house8 tests/tests.py::TestOtherHouses::test_air_source_heat_pump_has_no_ducts tests/tests.py::TestOtherHouses::test_attic_knee_wall tests/tests.py::TestOtherHouses::test_attic_knee_wall_zero_rvalue tests/tests.py::TestOtherHouses::test_attic_roof_assoc tests/tests.py::TestOtherHouses::test_bad_duct_location tests/tests.py::TestOtherHouses::test_bldgid_not_found tests/tests.py::TestOtherHouses::test_clg_sys_has_air_dist tests/tests.py::TestOtherHouses::test_cooling_system_wrong_efficiency_type tests/tests.py::TestOtherHouses::test_dist_sys_idref tests/tests.py::TestOtherHouses::test_evap_cooling_system_type tests/tests.py::TestOtherHouses::test_external_id_extension_passthru tests/tests.py::TestOtherHouses::test_external_id_passthru tests/tests.py::TestOtherHouses::test_extra_roof_sheathing_insulation tests/tests.py::TestOtherHouses::test_extra_wall_sheathing_insulation tests/tests.py::TestOtherHouses::test_floor_no_area tests/tests.py::TestOtherHouses::test_foundation_walls_on_slab tests/tests.py::TestOtherHouses::test_heating_system_no_efficiency tests/tests.py::TestOtherHouses::test_heating_system_wrong_efficiency_type tests/tests.py::TestOtherHouses::test_heatpump_no_cooling tests/tests.py::TestOtherHouses::test_heatpump_no_heating tests/tests.py::TestOtherHouses::test_hescore_min tests/tests.py::TestOtherHouses::test_htg_sys_has_air_dist tests/tests.py::TestOtherHouses::test_hvac_fractions_sum_to_one tests/tests.py::TestOtherHouses::test_impossible_cooling_system_type tests/tests.py::TestOtherHouses::test_impossible_heating_system_type tests/tests.py::TestOtherHouses::test_impossible_triple_pane_window tests/tests.py::TestOtherHouses::test_impossible_window tests/tests.py::TestOtherHouses::test_indirect_dhw_error tests/tests.py::TestOtherHouses::test_invalid_attic_type tests/tests.py::TestOtherHouses::test_invalid_residential_faciliy_type tests/tests.py::TestOtherHouses::test_invalid_roof_type tests/tests.py::TestOtherHouses::test_invalid_surroundings tests/tests.py::TestOtherHouses::test_log_wall_fail tests/tests.py::TestOtherHouses::test_mentor_extension tests/tests.py::TestOtherHouses::test_missing_attached_to_roof tests/tests.py::TestOtherHouses::test_missing_cooling_system tests/tests.py::TestOtherHouses::test_missing_cooling_weighting_factor tests/tests.py::TestOtherHouses::test_missing_heating_system tests/tests.py::TestOtherHouses::test_missing_heating_weighting_factor tests/tests.py::TestOtherHouses::test_missing_residential_facility_type tests/tests.py::TestOtherHouses::test_missing_roof_color tests/tests.py::TestOtherHouses::test_missing_roof_type tests/tests.py::TestOtherHouses::test_missing_siding tests/tests.py::TestOtherHouses::test_missing_skylight_area tests/tests.py::TestOtherHouses::test_missing_surroundings tests/tests.py::TestOtherHouses::test_missing_water_heater tests/tests.py::TestOtherHouses::test_missing_window_area tests/tests.py::TestOtherHouses::test_missing_window_orientation tests/tests.py::TestOtherHouses::test_only_duct_system_per_heating_sys tests/tests.py::TestOtherHouses::test_ove_low_r tests/tests.py::TestOtherHouses::test_preconstruction_event_type tests/tests.py::TestOtherHouses::test_siding_cmu_fail tests/tests.py::TestOtherHouses::test_siding_fail2 tests/tests.py::TestOtherHouses::test_tankless_coil_dhw_error tests/tests.py::TestOtherHouses::test_too_many_duct_systems tests/tests.py::TestOtherHouses::test_townhouse_walls tests/tests.py::TestOtherHouses::test_townhouse_walls_all_same tests/tests.py::TestOtherHouses::test_townhouse_walls_conflict tests/tests.py::TestOtherHouses::test_townhouse_window_fail tests/tests.py::TestOtherHouses::test_townhouse_window_wall_all_same_fail tests/tests.py::TestOtherHouses::test_townhouse_windows_area_wrong tests/tests.py::TestOtherHouses::test_wall_construction_ps_low_r tests/tests.py::TestOtherHouses::test_wall_insulation_layer_missing_rvalue tests/tests.py::TestOtherHouses::test_wall_same_area_same_side_different_construction tests/tests.py::TestOtherHouses::test_window_area_sum_on_angled_front_door tests/tests.py::TestOtherHouses::test_window_attached_to_wall tests/tests.py::TestOtherHouses::test_wood_stove tests/tests.py::TestOtherHouses::test_wood_stove_invalid_fuel_type tests/tests.py::TestOtherHouses::test_zipcode_missing tests/tests.py::TestInputOutOfBounds::test_assessment_date1 tests/tests.py::TestInputOutOfBounds::test_assessment_date2 tests/tests.py::TestInputOutOfBounds::test_conditioned_floor_area1 tests/tests.py::TestInputOutOfBounds::test_conditioned_floor_area2 tests/tests.py::TestInputOutOfBounds::test_cooling_efficiency tests/tests.py::TestInputOutOfBounds::test_cooling_year tests/tests.py::TestInputOutOfBounds::test_dhw_heat_pump_efficiency tests/tests.py::TestInputOutOfBounds::test_dhw_storage_efficiency tests/tests.py::TestInputOutOfBounds::test_dhw_year tests/tests.py::TestInputOutOfBounds::test_envelope_leakage tests/tests.py::TestInputOutOfBounds::test_evap_cooler_missing_efficiency tests/tests.py::TestInputOutOfBounds::test_floor_to_ceiling_height1 tests/tests.py::TestInputOutOfBounds::test_floor_to_ceiling_height2 tests/tests.py::TestInputOutOfBounds::test_heating_efficiency_furnace tests/tests.py::TestInputOutOfBounds::test_heating_efficiency_gchp tests/tests.py::TestInputOutOfBounds::test_heating_efficiency_heat_pump tests/tests.py::TestInputOutOfBounds::test_heating_year tests/tests.py::TestInputOutOfBounds::test_num_floor_above_grade tests/tests.py::TestInputOutOfBounds::test_skylight_area tests/tests.py::TestInputOutOfBounds::test_skylight_u_value tests/tests.py::TestInputOutOfBounds::test_window_area tests/tests.py::TestInputOutOfBounds::test_window_u_value tests/tests.py::TestInputOutOfBounds::test_year_built1 tests/tests.py::TestInputOutOfBounds::test_year_built2 tests/tests.py::TestHVACFractions::test_allow_5pct_diff tests/tests.py::TestHVACFractions::test_boiler_roomac tests/tests.py::TestHVACFractions::test_furnace_baseboard_centralac tests/tests.py::TestHVACFractions::test_furnace_heat_pump tests/tests.py::TestHVACFractions::test_wall_furnace_baseboard_centralac tests/tests.py::TestPhotovoltaics::test_azimuth_orientation_missing tests/tests.py::TestPhotovoltaics::test_capacity_missing tests/tests.py::TestPhotovoltaics::test_collector_area tests/tests.py::TestPhotovoltaics::test_orientation tests/tests.py::TestPhotovoltaics::test_pv tests/tests.py::TestPhotovoltaics::test_two_sys_avg tests/tests.py::TestPhotovoltaics::test_two_sys_different_capacity_error tests/tests.py::TestPhotovoltaics::test_years_missing tests/tests.py::TesHPXMLVersion2Point3::test_floor_furnace tests/tests.py::TesHPXMLVersion2Point3::test_medium_dark_roof_color tests/tests.py::TesHPXMLVersion2Point3::test_roof_absorptance tests/tests.py::TestHEScore2019Updates::test_bldg_about_comment tests/tests.py::TestHEScore2019Updates::test_conditioned_attic tests/tests.py::TestHEScore2019Updates::test_duct_location_validation tests/tests.py::TestHEScore2019Updates::test_hpwes tests/tests.py::TestHEScore2019Updates::test_hpwes_fail tests/tests.py::TestHEScore2019Updates::test_hvac_combinations tests/tests.py::TestHEScore2019Updates::test_mini_split_cooling_only tests/tests.py::TestHEScore2019Updates::test_skylight_solar_screens_exteriorshading tests/tests.py::TestHEScore2019Updates::test_skylight_solar_screens_treatments tests/tests.py::TestHEScore2019Updates::test_tankless tests/tests.py::TestHEScore2019Updates::test_tankless_energyfactorerror tests/tests.py::TestHEScore2019Updates::test_uef_over_ef tests/tests.py::TestHEScore2019Updates::test_uef_with_tankless tests/tests.py::TestHEScore2019Updates::test_window_code_mappings_aluminum tests/tests.py::TestHEScore2019Updates::test_window_solar_screens
hescorehpxml/__init__.py
hescorehpxml/__init__.py