@@ -1604,18 +1604,24 @@ async def _execute(
1604
1604
result .args = (msg ,) + result .args [1 :]
1605
1605
raise result
1606
1606
1607
- default_node = nodes .get (client .get_default_node ().name )
1608
- if default_node is not None :
1609
- # This pipeline execution used the default node, check if we need
1610
- # to replace it.
1611
- # Note: when the error is raised we'll reset the default node in the
1612
- # caller function.
1613
- for cmd in default_node [1 ]:
1614
- # Check if it has a command that failed with a relevant
1615
- # exception
1616
- if type (cmd .result ) in self .__class__ .ERRORS_ALLOW_RETRY :
1617
- client .replace_default_node ()
1618
- break
1607
+ default_cluster_node = client .get_default_node ()
1608
+
1609
+ # Check whether the default node was used. In some cases,
1610
+ # 'client.get_default_node()' may return None. The check below
1611
+ # prevents a potential AttributeError.
1612
+ if default_cluster_node is not None :
1613
+ default_node = nodes .get (default_cluster_node .name )
1614
+ if default_node is not None :
1615
+ # This pipeline execution used the default node, check if we need
1616
+ # to replace it.
1617
+ # Note: when the error is raised we'll reset the default node in the
1618
+ # caller function.
1619
+ for cmd in default_node [1 ]:
1620
+ # Check if it has a command that failed with a relevant
1621
+ # exception
1622
+ if type (cmd .result ) in self .__class__ .ERRORS_ALLOW_RETRY :
1623
+ client .replace_default_node ()
1624
+ break
1619
1625
1620
1626
return [cmd .result for cmd in stack ]
1621
1627
0 commit comments