From b2ea749c72bfaf9ea360117feaaaddd8e27554bf Mon Sep 17 00:00:00 2001 From: psychedelicious <4822129+psychedelicious@users.noreply.github.com> Date: Mon, 25 Mar 2024 19:07:10 +1100 Subject: [PATCH] fix(mm): handle any error during installation Previously we only handled expected error types. If a different error was raised, the install job would end up in an unexpected state where it has failed and isn't doing anything, but its status is still running. This indirectly prevents the installer threads from exiting - they are waiting for all jobs to be completed, including the failed-but-still-running job. We need to handle any error here to prevent this. --- .../app/services/model_install/model_install_default.py | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/invokeai/app/services/model_install/model_install_default.py b/invokeai/app/services/model_install/model_install_default.py index 04d2d5fd39..76a85865b8 100644 --- a/invokeai/app/services/model_install/model_install_default.py +++ b/invokeai/app/services/model_install/model_install_default.py @@ -457,11 +457,10 @@ class ModelInstallService(ModelInstallServiceBase): elif job.waiting or job.downloads_done: self._register_or_install(job) - except InvalidModelConfigException as excp: - self._set_error(job, excp) - - except (OSError, DuplicateModelException) as excp: - self._set_error(job, excp) + except Exception as e: + # Expected errors include InvalidModelConfigException, DuplicateModelException, OSError, but we must + # gracefully handle _any_ error here. + self._set_error(job, e) finally: # if this is an install of a remote file, then clean up the temporary directory