diff --git a/pydatalab/pydatalab/remote_filesystems.py b/pydatalab/pydatalab/remote_filesystems.py index 380817ce7..757e6598c 100644 --- a/pydatalab/pydatalab/remote_filesystems.py +++ b/pydatalab/pydatalab/remote_filesystems.py @@ -208,7 +208,16 @@ def _call_remote_tree( except Exception as exc: raise RuntimeError(f"Remote tree process {command!r} returned: {exc!r}") if stderr: - raise RuntimeError(f"Remote tree process {command!r} returned: {stderr!r}") + # Do not return the bare stderr, but instead specialise the error message to common errors + if "WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!" in stderr.decode("utf-8"): + msg = f"Remote host identification has changed for {hostname}: please contact the administrator of this datalab deployment." + LOGGER.error( + "Remote host identification for %s has changed, failed to update remote directories", + hostname, + ) + else: + msg = "Remote tree process returned an error: please contact the administrator of this datalab deployment." + raise RuntimeError(msg) try: return json.loads(stdout)