diff --git a/apps/api/src/services/telegram_gateway.py b/apps/api/src/services/telegram_gateway.py index 7e3cfd6ca..631c340ba 100644 --- a/apps/api/src/services/telegram_gateway.py +++ b/apps/api/src/services/telegram_gateway.py @@ -6639,11 +6639,12 @@ class TelegramGateway: except Exception as exc: logger.warning( "controlled_apply_result_finalize_failed", - automation_run_id=identity["automation_run_id"], - incident_id=identity["incident_id"], - apply_op_id=identity["apply_op_id"], + automation_run_id=identity.get("automation_run_id"), + incident_id=identity.get("incident_id"), + apply_op_id=identity.get("apply_op_id"), attempt=attempt + 1, error_type=type(exc).__name__, + error_detail=str(exc), ) if attempt + 1 < _CONTROLLED_APPLY_OUTBOUND_FINALIZE_ATTEMPTS: await asyncio.sleep(0.05 * (attempt + 1))