diff --git a/remoteappmanager/handlers/home_handler.py b/remoteappmanager/handlers/home_handler.py
index c21824b..7d5ce97 100644
--- a/remoteappmanager/handlers/home_handler.py
+++ b/remoteappmanager/handlers/home_handler.py
@@ -131,8 +131,10 @@ class HomeHandler(BaseHandler):
         container_manager = self.application.container_manager
         container = yield container_manager.container_from_url_id(url_id)
         if not container:
-            self.finish("Unable to view the application")
-            return
+            self.log.warning("Could not find container for url_id {}".format(
+                url_id
+            ))
+            raise ValueError("Unable to view container for specified url_id")
 
         # make sure the container is actually running and working
         yield self._wait_for_container_ready(container)
@@ -158,8 +160,10 @@ class HomeHandler(BaseHandler):
 
         container = yield container_manager.container_from_url_id(url_id)
         if not container:
-            self.finish("Unable to view the application")
-            return
+            self.log.warning("Could not find container for url_id {}".format(
+                url_id
+            ))
+            raise ValueError("Unable to view container for specified url_id")
 
         urlpath = url_path_join(
             self.application.command_line_config.base_urlpath,

HomeHandler should not 'finish' in View and Stop but raise
Let view and stop raise and then the HomeHandler.post will handle the logging.

https://github.com/simphony/simphony-remote/blob/98ee374756694ef1855a9d38d78d3561ec6cc54e/remoteappmanager/handlers/home_handler.py#L155

https://github.com/simphony/simphony-remote/blob/98ee374756694ef1855a9d38d78d3561ec6cc54e/remoteappmanager/handlers/home_handler.py#L132
diff --git a/tests/handlers/test_home_handler.py b/tests/handlers/test_home_handler.py
index 596b8db..7a49d7f 100644
--- a/tests/handlers/test_home_handler.py
+++ b/tests/handlers/test_home_handler.py
@@ -184,3 +184,34 @@ class TestHomeHandler(TempMixin, utils.AsyncHTTPTestCase):
 
             self.assertTrue(self._app.reverse_proxy.register.called)
             self.assertTrue(redirect.called)
+
+    def test_container_manager_does_not_return_container(self):
+        self._app.container_manager.container_from_url_id = \
+            utils.mock_coro_factory(None)
+        res = self.fetch(
+            "/user/username/",
+            method="POST",
+            headers={
+                "Cookie": "jupyter-hub-token-username=foo"
+            },
+            body=urllib.parse.urlencode({
+                'action': 'view',
+                'url_id': '12345'
+            })
+        )
+
+        self.assertIn("ValueError", str(res.body))
+
+        res = self.fetch(
+            "/user/username/",
+            method="POST",
+            headers={
+                "Cookie": "jupyter-hub-token-username=foo"
+            },
+            body=urllib.parse.urlencode({
+                'action': 'stop',
+                'url_id': '12345'
+            })
+        )
+
+        self.assertIn("ValueError", str(res.body))

pip install -e .[dev]
parse_log_pytest
requirements.txt
pytest flake8 sphinx coverage
apt-get update apt-get install -y gcc
3.9
requirements.txt dev-requirements.txt
pytest --no-header -rA --tb=line --color=no -p no:cacheprovider -W ignore::DeprecationWarning
alabaster==0.7.16
alembic==1.15.2
annotated-types==0.7.0
arrow==1.3.0
async-generator==1.10
attrs==25.3.0
babel==2.17.0
certifi==2025.1.31
certipy==0.2.2
cffi==1.17.1
charset-normalizer==3.4.1
click==8.1.8
coverage==7.8.0
cryptography==44.0.2
docker-py==1.10.6
docker-pycreds==0.4.0
docutils==0.21.2
escapism==1.0.1
exceptiongroup==1.2.2
flake8==7.2.0
fqdn==1.5.1
greenlet==3.1.1
idna==3.10
imagesize==1.4.1
importlib_metadata==8.6.1
iniconfig==2.1.0
isoduration==20.11.0
Jinja2==3.1.6
jsonpointer==3.0.0
jsonschema==4.23.0
jsonschema-specifications==2024.10.1
jupyter-events==0.12.0
jupyter_client==8.6.3
jupyter_core==5.7.2
jupyterhub==5.2.1
Mako==1.3.9
MarkupSafe==3.0.2
mccabe==0.7.0
oauthlib==3.2.2
packaging==24.2
pamela==1.2.0
platformdirs==4.3.7
pluggy==1.5.0
prometheus_client==0.21.1
pycodestyle==2.13.0
pycparser==2.22
pydantic==2.11.1
pydantic_core==2.33.0
pyflakes==3.3.1
Pygments==2.19.1
pytest==8.3.5
python-dateutil==2.9.0.post0
python-json-logger==3.3.0
PyYAML==6.0.2
pyzmq==26.3.0
referencing==0.36.2
-e git+https://github.com/simphony/simphony-remote.git@ae2c07cdf3906952600c57b4439d57d7ff4b2cc1#egg=remoteappmanager
requests==2.32.3
rfc3339-validator==0.1.4
rfc3986-validator==0.1.1
rpds-py==0.24.0
six==1.17.0
snowballstemmer==2.2.0
Sphinx==7.4.7
sphinxcontrib-applehelp==2.0.0
sphinxcontrib-devhelp==2.0.0
sphinxcontrib-htmlhelp==2.1.0
sphinxcontrib-jsmath==1.0.1
sphinxcontrib-qthelp==2.0.0
sphinxcontrib-serializinghtml==2.0.0
SQLAlchemy==2.0.40
tabulate==0.9.0
tomli==2.2.1
tornado==6.4.2
traitlets==5.14.3
types-python-dateutil==2.9.0.20241206
typing-inspection==0.4.0
typing_extensions==4.13.0
uri-template==1.3.0
urllib3==2.3.0
webcolors==24.11.1
websocket-client==1.8.0
zipp==3.21.0

name: simphony-remote
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
  - 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=3.0.16=h5eee18b_0
  - pip=25.0=py39h06a4308_0
  - python=3.9.21=he870216_1
  - readline=8.2=h5eee18b_0
  - setuptools=75.8.0=py39h06a4308_0
  - sqlite=3.45.3=h5eee18b_0
  - tk=8.6.14=h39e8969_0
  - tzdata=2025a=h04d1e81_0
  - wheel=0.45.1=py39h06a4308_0
  - xz=5.6.4=h5eee18b_1
  - zlib=1.2.13=h5eee18b_1
  - pip:
      - alabaster==0.7.16
      - alembic==1.15.2
      - annotated-types==0.7.0
      - arrow==1.3.0
      - async-generator==1.10
      - attrs==25.3.0
      - babel==2.17.0
      - certifi==2025.1.31
      - certipy==0.2.2
      - cffi==1.17.1
      - charset-normalizer==3.4.1
      - click==8.1.8
      - coverage==7.8.0
      - cryptography==44.0.2
      - docker-py==1.10.6
      - docker-pycreds==0.4.0
      - docutils==0.21.2
      - escapism==1.0.1
      - exceptiongroup==1.2.2
      - flake8==7.2.0
      - fqdn==1.5.1
      - greenlet==3.1.1
      - idna==3.10
      - imagesize==1.4.1
      - importlib-metadata==8.6.1
      - iniconfig==2.1.0
      - isoduration==20.11.0
      - jinja2==3.1.6
      - jsonpointer==3.0.0
      - jsonschema==4.23.0
      - jsonschema-specifications==2024.10.1
      - jupyter-client==8.6.3
      - jupyter-core==5.7.2
      - jupyter-events==0.12.0
      - jupyterhub==5.2.1
      - mako==1.3.9
      - markupsafe==3.0.2
      - mccabe==0.7.0
      - oauthlib==3.2.2
      - packaging==24.2
      - pamela==1.2.0
      - platformdirs==4.3.7
      - pluggy==1.5.0
      - prometheus-client==0.21.1
      - pycodestyle==2.13.0
      - pycparser==2.22
      - pydantic==2.11.1
      - pydantic-core==2.33.0
      - pyflakes==3.3.1
      - pygments==2.19.1
      - pytest==8.3.5
      - python-dateutil==2.9.0.post0
      - python-json-logger==3.3.0
      - pyyaml==6.0.2
      - pyzmq==26.3.0
      - referencing==0.36.2
      - requests==2.32.3
      - rfc3339-validator==0.1.4
      - rfc3986-validator==0.1.1
      - rpds-py==0.24.0
      - six==1.17.0
      - snowballstemmer==2.2.0
      - sphinx==7.4.7
      - sphinxcontrib-applehelp==2.0.0
      - sphinxcontrib-devhelp==2.0.0
      - sphinxcontrib-htmlhelp==2.1.0
      - sphinxcontrib-jsmath==1.0.1
      - sphinxcontrib-qthelp==2.0.0
      - sphinxcontrib-serializinghtml==2.0.0
      - sqlalchemy==2.0.40
      - tabulate==0.9.0
      - tomli==2.2.1
      - tornado==6.4.2
      - traitlets==5.14.3
      - types-python-dateutil==2.9.0.20241206
      - typing-extensions==4.13.0
      - typing-inspection==0.4.0
      - uri-template==1.3.0
      - urllib3==2.3.0
      - webcolors==24.11.1
      - websocket-client==1.8.0
      - zipp==3.21.0
prefix: /opt/conda/envs/simphony-remote

tests/handlers/test_home_handler.py::TestHomeHandler::test_container_manager_does_not_return_container
tests/handlers/test_home_handler.py::TestHomeHandler::test_failed_auth tests/handlers/test_home_handler.py::TestHomeHandler::test_home tests/handlers/test_home_handler.py::TestHomeHandler::test_post_failed_auth tests/handlers/test_home_handler.py::TestHomeHandler::test_post_start tests/handlers/test_home_handler.py::TestHomeHandler::test_post_stop tests/handlers/test_home_handler.py::TestHomeHandler::test_post_view
remoteappmanager/handlers/home_handler.py
remoteappmanager/handlers/home_handler.py