From 03816614902e5d94e7c2ec49106901e45b10a19e Mon Sep 17 00:00:00 2001 From: Victor Skvortsov Date: Tue, 26 Aug 2025 15:38:45 +0500 Subject: [PATCH] Fix DataCrunchCompute exception when terminating already removed instance --- src/dstack/_internal/core/backends/datacrunch/compute.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/dstack/_internal/core/backends/datacrunch/compute.py b/src/dstack/_internal/core/backends/datacrunch/compute.py index 49b68c080b..813634b675 100644 --- a/src/dstack/_internal/core/backends/datacrunch/compute.py +++ b/src/dstack/_internal/core/backends/datacrunch/compute.py @@ -161,7 +161,10 @@ def terminate_instance( try: self.client.instances.action(id_list=[instance_id], action="delete") except APIException as e: - if e.message == "Invalid instance id": + if e.message in [ + "Invalid instance id", + "Can't discontinue a discontinued instance", + ]: logger.debug("Skipping instance %s termination. Instance not found.", instance_id) return raise