diff --git a/CHANGELOG.md b/CHANGELOG.md index f5f1f8d..d4f27fd 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,12 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## Unreleased + +FIXED: + +- Fix unbound variable in entity V1 processing + ## v1.3.0 ADDED diff --git a/durabletask/worker.py b/durabletask/worker.py index 35174fe..442165d 100644 --- a/durabletask/worker.py +++ b/durabletask/worker.py @@ -740,21 +740,22 @@ def _execute_entity_batch( stub: Union[stubs.TaskHubSidecarServiceStub, ProtoTaskHubSidecarServiceStub], completionToken, ): + operation_infos: list[pb.OperationInfo] = [] if isinstance(req, pb.EntityRequest): req, operation_infos = helpers.convert_to_entity_batch_request(req) entity_state = StateShim(shared.from_json(req.entityState.value) if req.entityState.value else None) instance_id = req.instanceId + try: + entity_instance_id = EntityInstanceId.parse(instance_id) + except ValueError: + raise RuntimeError(f"Invalid entity instance ID '{instance_id}' in entity operation request.") results: list[pb.OperationResult] = [] for operation in req.operations: start_time = datetime.now(timezone.utc) executor = _EntityExecutor(self._registry, self._logger) - try: - entity_instance_id = EntityInstanceId.parse(instance_id) - except ValueError: - raise RuntimeError(f"Invalid entity instance ID '{instance_id}' in entity operation request.") operation_result = None