From 2f63defb533aa92e077cfea3471aa963af6d582b Mon Sep 17 00:00:00 2001 From: Zamil Majdy Date: Fri, 5 Dec 2025 18:12:18 +0700 Subject: [PATCH] fix(backend): Mark ValueError as known block errors (#11537) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit ### Changes 🏗️ Mark ValueError as known block errors ### Checklist 📋 #### For code changes: - [x] I have clearly listed my changes in the PR description - [x] I have made a test plan - [x] I have tested my changes according to the test plan: --- autogpt_platform/backend/backend/data/block.py | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/autogpt_platform/backend/backend/data/block.py b/autogpt_platform/backend/backend/data/block.py index 315d63bd8f..727688dcf0 100644 --- a/autogpt_platform/backend/backend/data/block.py +++ b/autogpt_platform/backend/backend/data/block.py @@ -601,14 +601,18 @@ class Block(ABC, Generic[BlockSchemaInputType, BlockSchemaOutputType]): async for output_name, output_data in self._execute(input_data, **kwargs): yield output_name, output_data except Exception as ex: - if not isinstance(ex, BlockError): - raise BlockUnknownError( + if isinstance(ex, BlockError): + raise ex + else: + raise ( + BlockExecutionError + if isinstance(ex, ValueError) + else BlockUnknownError + )( message=str(ex), block_name=self.name, block_id=self.id, ) from ex - else: - raise ex async def _execute(self, input_data: BlockInput, **kwargs) -> BlockOutput: if error := self.input_schema.validate_data(input_data):