See build log in PR googleapis/gapic-generator-python#2361 which fails with the following stack trace.
if self._exception is not None:
# pylint: disable=raising-bad-type
# Pylint doesn't recognize that this is valid in this case.
> raise self._exception
E google.api_core.exceptions.GoogleAPICallError: None Unexpected state: Long-running operation had neither response nor error set.
FAILED tests/system/test_lro.py::test_lro_no_result[grpc] - google.api_core.exceptions.GoogleAPICallError: None Unexpected state: Long-running operation had neither response nor error set.
FAILED tests/system/test_lro.py::test_lro_no_result[rest] - google.api_core.exceptions.GoogleAPICallError: None Unexpected state: Long-running operation had neither response nor error set.
FAILED tests/system/test_lro.py::test_lro_async_no_result[grpc_asyncio] - google.api_core.exceptions.GoogleAPICallError: None Unexpected state: Long-running operation had neither response nor error set.
This error happens when the LRO response does not contain a result. For example, see the response below when running showcase.
2025/03/13 23:49:19 Received Unary Request for Method: /google.longrunning.Operations/GetOperation
2025/03/13 23:49:19 Request: name:"operations/google.showcase.v1beta1.Echo/Wait/CgwI/t3NvgYQyJqJpgM="
2025/03/13 23:49:19 Returning Response: name:"operations/google.showcase.v1beta1.Echo/Wait/CgwI/t3NvgYQyJqJpgM=" done:true
2025/03/13 23:49:19
name and done are set but there is no result. In other words, neither error nor response is set.
As per https://github.com/googleapis/googleapis/blob/a6c9ed2d33105cb3dc9a0867a0a5d761b049b932/google/longrunning/operations.proto#L141,
Some services might not provide the result.
When services don't provide a result, the response should be None instead of the exception Unexpected state: Long-running operation had neither response nor error set.
See build log in PR googleapis/gapic-generator-python#2361 which fails with the following stack trace.
This error happens when the LRO response does not contain a result. For example, see the response below when running showcase.
name and done are set but there is no result. In other words, neither error nor response is set.
As per https://github.com/googleapis/googleapis/blob/a6c9ed2d33105cb3dc9a0867a0a5d761b049b932/google/longrunning/operations.proto#L141,
When services don't provide a result, the response should be
Noneinstead of the exceptionUnexpected state: Long-running operation had neither response nor error set.