microsoft / microsoft/azure-quantum-python
Qiskit job result missing attributes cause wrong exception when job fails in VQE
Nobody has claimed this yet.
- Dominant language
- Python
- Stars
- 160
- Forks
- 113
- Avg merge
- 6d 23h
- Merged PRs (30d)
- 1
Description
If running the VQE sample and it fails to run on a quantum_instance (for instance, if Quantinuum is out of credits), then instead of printing the error code and message, it prints that an attribute "status" could not be found.

It looks like this is throwing from when it tries to read result.status from run_circuits.py.
Looking at the latest definition of Result object in qiskit, it looks like for the error_data message to be shown, we should encode the error_data into status field as well.
This is where we encode job result into Qiskit result as part of azure-quantum: https://github.com/microsoft/qdk-python/blob/944fac0ee64e962b65b73f29635a2c65abf332d7/azure-quantum/azure/quantum/qiskit/job.py#L93
Current:
result_dict = {
"results" : [results],
"job_id" : self._azure_job.details.id,
"backend_name" : self._backend.name(),
"backend_version" : self._backend.version,
"qobj_id" : self._azure_job.details.name,
"success" : success,
"error_data" : None if self._azure_job.details.error_data is None else self._azure_job.details.error_data.as_dict()
}
Proposed change:
error_msg = None if self._azure_job.details.error_data is None else self._azure_job.details.error_data.as_dict()
result_dict = {
"results" : [results],
"job_id" : self._azure_job.details.id,
"backend_name" : self._backend.name(),
"backend_version" : self._backend.version,
"qobj_id" : self._azure_job.details.name,
"success" : success,
"error_data" : error_msg,
"status": error_msg,
}
We may optionally want to add the other missing attributes on Qiskit result that are currently not populated, such as date, header, in case they also cause errors down the road.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in azure/quantum/qiskit/job.py around the result_dict construction referenced in the issue, and compare its output with the Qiskit Result expectations. Reproduce the failed VQE job scenario, then verify that the resulting error information is available through the expected result attributes without breaking successful jobs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- azure, python
- Domain
- backend, quantum-computing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100