diff --git a/src/openeo_pg_parser_python/translate_process_graph.py b/src/openeo_pg_parser_python/translate_process_graph.py
index bbbffde..3982dcd 100644
--- a/src/openeo_pg_parser_python/translate_process_graph.py
+++ b/src/openeo_pg_parser_python/translate_process_graph.py
@@ -216,10 +216,12 @@ def link_nodes(graph):
 
 def translate_graph(pg_filepath):
     if isinstance(pg_filepath, str):
-        if os.path.isfile(pg_filepath):
-            pg_dict = load(open(pg_filepath))
+        pg_dict = load(open(pg_filepath))
     elif isinstance(pg_filepath, dict):
         pg_dict = pg_filepath
+    else:
+        raise ValueError("'pg_filepath must either be file path to a JSON file or a dictionary.'")
+
     nodes = OrderedDict()
     nodes, _, _, _ = walk_pg_graph(nodes, pg_dict)
     # create graph object

Unclear error when JSON file not found
Currently, when the input JSON file (or related python dict) is not found, the following error is returned:
`UnboundLocalError: local variable 'pg_dict' referenced before assignment`

This is not clear and very unfriendly to debug, add check if input file exists or if input dict is not empty.
diff --git a/tests/test_translate_pg.py b/tests/test_translate_pg.py
new file mode 100644
index 0000000..20140b8
--- /dev/null
+++ b/tests/test_translate_pg.py
@@ -0,0 +1,21 @@
+import unittest
+from openeo_pg_parser_python.translate_process_graph import translate_graph
+
+
+class PGTranslateTester(unittest.TestCase):
+    """ Responsible for testing the translation of an openEO process graph. """
+
+    def setUp(self):
+        """ Specifies paths to the test data. """
+
+        self.pg_test_1_filepath = r"process_graphs/test_1.json"
+
+    def test_pg_not_found(self):
+        pg_filepath = r"process_graphs/does_not_exist.json"
+        try:
+            translate_graph(pg_filepath)
+        except FileNotFoundError:
+            assert True
+
+if __name__ == '__main__':
+    unittest.main()
\ No newline at end of file

conda_environment.yml
python setup.py develop
parse_log_pytest
environment.yml
pytest pytest-cov
3.9
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
attrs==22.2.0
brotlipy==0.7.0
certifi==2021.5.30
cffi @ file:///home/conda/feedstock_root/build_artifacts/cffi_1631636256886/work
charset-normalizer @ file:///tmp/build/80754af9/charset-normalizer_1630003229654/work
coverage==6.2
cryptography @ file:///tmp/build/80754af9/cryptography_1635366128178/work
idna @ file:///tmp/build/80754af9/idna_1637925883363/work
importlib-metadata==4.8.3
iniconfig==1.1.1
-e git+https://github.com/Open-EO/openeo-pg-parser-python.git@fbc4daccbc518e19099a72b9891530c57de9fc17#egg=openeo_pg_parser_python
packaging==21.3
pluggy==1.0.0
py==1.11.0
pycparser @ file:///tmp/build/80754af9/pycparser_1636541352034/work
pyOpenSSL @ file:///opt/conda/conda-bld/pyopenssl_1643788558760/work
pyparsing==3.1.4
PySocks @ file:///tmp/build/80754af9/pysocks_1605305763431/work
pytest==7.0.1
pytest-cov==4.0.0
requests @ file:///opt/conda/conda-bld/requests_1641824580448/work
tomli==1.2.3
typing_extensions==4.1.1
urllib3 @ file:///opt/conda/conda-bld/urllib3_1643638302206/work
zipp==3.6.0

name: openeo-pg-parser-python
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
  - brotlipy=0.7.0=py36h27cfd23_1003
  - ca-certificates=2025.2.25=h06a4308_0
  - certifi=2021.5.30=py36h06a4308_0
  - cffi=1.14.6=py36hd8eec40_1
  - charset-normalizer=2.0.4=pyhd3eb1b0_0
  - cryptography=35.0.0=py36hd23ed53_0
  - idna=3.3=pyhd3eb1b0_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=21.2.2=py36h06a4308_0
  - pycparser=2.21=pyhd3eb1b0_0
  - pyopenssl=22.0.0=pyhd3eb1b0_0
  - pysocks=1.7.1=py36h06a4308_0
  - python=3.6.13=hb7a2778_2_cpython
  - python_abi=3.6=2_cp36m
  - readline=8.2=h5eee18b_0
  - requests=2.27.1=pyhd3eb1b0_0
  - setuptools=58.0.4=py36h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - urllib3=1.26.8=pyhd3eb1b0_0
  - wheel=0.37.1=pyhd3eb1b0_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - attrs==22.2.0
      - coverage==6.2
      - importlib-metadata==4.8.3
      - iniconfig==1.1.1
      - packaging==21.3
      - pluggy==1.0.0
      - py==1.11.0
      - pyparsing==3.1.4
      - pytest==7.0.1
      - pytest-cov==4.0.0
      - tomli==1.2.3
      - typing-extensions==4.1.1
      - zipp==3.6.0
prefix: /opt/conda/envs/openeo-pg-parser-python

tests/test_translate_pg.py::PGTranslateTester::test_pg_not_found
src/openeo_pg_parser_python/translate_process_graph.py
src/openeo_pg_parser_python/translate_process_graph.py