diff --git a/k8s_handle/config.py b/k8s_handle/config.py
index df08de4..17cdb33 100644
--- a/k8s_handle/config.py
+++ b/k8s_handle/config.py
@@ -156,6 +156,9 @@ def _update_context_recursively(context, include_history=[]):
 
 
 def load_context_section(section):
+    if not section:
+        raise RuntimeError('Empty section specification is not allowed')
+
     if section == settings.COMMON_SECTION_NAME:
         raise RuntimeError('Section "{}" is not intended to deploy'.format(settings.COMMON_SECTION_NAME))
 
@@ -163,7 +166,8 @@ def load_context_section(section):
 
     if context is None:
         raise RuntimeError('Config file "{}" is empty'.format(settings.CONFIG_FILE))
-    if section and section not in context:
+
+    if section not in context:
         raise RuntimeError('Section "{}" not found in config file "{}"'.format(section, settings.CONFIG_FILE))
 
     # delete all sections except common and used section

Empty section passes validation
Empty section string (-s "") passes validation and causes not wrapped KeyError. 
diff --git a/tests/test_config.py b/tests/test_config.py
index ce3e228..82e978e 100644
--- a/tests/test_config.py
+++ b/tests/test_config.py
@@ -65,6 +65,11 @@ class TestContextGeneration(unittest.TestCase):
             config.load_context_section('no_templates_section')
         self.assertTrue('Section "templates" or "kubectl" not found in config file' in str(context.exception))
 
+    def test_empty_section(self):
+        with self.assertRaises(RuntimeError) as context:
+            config.load_context_section('')
+        self.assertEqual('Empty section specification is not allowed', str(context.exception))
+
     def test_common_section(self):
         with self.assertRaises(RuntimeError) as context:
             config.load_context_section(settings.COMMON_SECTION_NAME)

pip install -e .[dev]
parse_log_pytest
requirements.txt
flake8 coveralls pytest
apt-get update apt-get install -y gcc
3.6
requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
adal==1.2.7
attrs==22.2.0
cachetools==4.2.4
certifi==2021.5.30
cffi==1.15.1
chardet==3.0.4
coverage==6.2
coveralls==3.3.1
cryptography==40.0.2
docopt==0.6.2
flake8==5.0.4
google-auth==2.22.0
idna==2.7
importlib-metadata==4.2.0
iniconfig==1.1.1
Jinja2==2.10
-e git+https://github.com/2gis/k8s-handle.git@92f764f44301bcd406d588a4db5cf0333fc1ccc2#egg=k8s_handle
kubernetes==7.0.0
MarkupSafe==2.0.1
mccabe==0.7.0
oauthlib==3.2.2
packaging==21.3
pluggy==1.0.0
py==1.11.0
pyasn1==0.5.1
pyasn1-modules==0.3.0
pycodestyle==2.9.1
pycparser==2.21
pyflakes==2.5.0
PyJWT==2.4.0
pyparsing==3.1.4
pytest==7.0.1
python-dateutil==2.9.0.post0
PyYAML==3.13
requests==2.20.1
requests-oauthlib==2.0.0
rsa==4.9
semver==2.8.1
six==1.17.0
tomli==1.2.3
typing_extensions==4.1.1
urllib3==1.24.3
websocket-client==1.3.1
zipp==3.6.0

name: k8s-handle
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=2021.5.30=py36h06a4308_0
  - ld_impl_linux-64=2.40=h12ee557_0
  - libffi=3.3=he6710b0_2
  - 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=21.2.2=py36h06a4308_0
  - python=3.6.13=h12debd9_1
  - readline=8.2=h5eee18b_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - adal==1.2.7
      - attrs==22.2.0
      - cachetools==4.2.4
      - cffi==1.15.1
      - chardet==3.0.4
      - coverage==6.2
      - coveralls==3.3.1
      - cryptography==40.0.2
      - docopt==0.6.2
      - flake8==5.0.4
      - google-auth==2.22.0
      - idna==2.7
      - importlib-metadata==4.2.0
      - iniconfig==1.1.1
      - jinja2==2.10
      - kubernetes==7.0.0
      - markupsafe==2.0.1
      - mccabe==0.7.0
      - oauthlib==3.2.2
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pyasn1==0.5.1
      - pyasn1-modules==0.3.0
      - pycodestyle==2.9.1
      - pycparser==2.21
      - pyflakes==2.5.0
      - pyjwt==2.4.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - python-dateutil==2.9.0.post0
      - pyyaml==3.13
      - requests==2.20.1
      - requests-oauthlib==2.0.0
      - rsa==4.9
      - semver==2.8.1
      - six==1.17.0
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - urllib3==1.24.3
      - websocket-client==1.3.1
      - zipp==3.6.0
prefix: /opt/conda/envs/k8s-handle

tests/test_config.py::TestContextGeneration::test_empty_section
tests/test_config.py::TestContextGeneration::test_check_empty_var tests/test_config.py::TestContextGeneration::test_common_section tests/test_config.py::TestContextGeneration::test_concatination_with_env tests/test_config.py::TestContextGeneration::test_config_incorrect tests/test_config.py::TestContextGeneration::test_config_is_empty tests/test_config.py::TestContextGeneration::test_config_not_exist tests/test_config.py::TestContextGeneration::test_context_update_recursion tests/test_config.py::TestContextGeneration::test_context_update_section tests/test_config.py::TestContextGeneration::test_dashes_in_var_names tests/test_config.py::TestContextGeneration::test_env_var_in_include_2_levels_dont_set tests/test_config.py::TestContextGeneration::test_env_var_in_include_dont_set tests/test_config.py::TestContextGeneration::test_env_var_in_section1_dont_set tests/test_config.py::TestContextGeneration::test_env_var_in_section2_dont_set tests/test_config.py::TestContextGeneration::test_infinite_recursion_loop tests/test_config.py::TestContextGeneration::test_merge_section_options tests/test_config.py::TestContextGeneration::test_no_templates tests/test_config.py::TestContextGeneration::test_not_existed_section tests/test_config.py::TestContextGeneration::test_recursive_vars tests/test_config.py::TestPriorityEvaluation::test_environment_deprecated tests/test_config.py::TestPriorityEvaluation::test_first_none_argument tests/test_config.py::TestPriorityEvaluation::test_first_priority tests/test_config.py::TestPriorityEvaluation::test_k8s_client_configuration_missing_k8s_ca tests/test_config.py::TestPriorityEvaluation::test_k8s_client_configuration_missing_token tests/test_config.py::TestPriorityEvaluation::test_k8s_client_configuration_missing_uri tests/test_config.py::TestPriorityEvaluation::test_k8s_client_configuration_success tests/test_config.py::TestPriorityEvaluation::test_k8s_namespace_default
k8s_handle/config.py
k8s_handle/config.py