Skip to content

ErrorCode

ErrorCode is an enumeration representing error codes returned by QPilot OS operations. These codes indicate the type of failure that occurred during quantum job submission, execution, or result retrieval.

Overview

Error codes help diagnose issues when interacting with the QPilot OS platform. Each code corresponds to a specific category of failure, from database errors to chip offline conditions.

Enum Values

Success

ValueDescription
NO_ERROR_FOUNDNo error occurred; the operation completed successfully

Data and Format Errors

ValueDescription
DATABASE_ERRORA database operation failed
ORIGINIR_ERRORThe OriginIR program string is invalid or malformed
JSON_FIELD_ERRORA required JSON field is missing or contains an invalid value
ERR_PARAMETERInvalid or missing parameter in the request
ERR_TASK_CONFIGTask configuration is invalid

Backend and Computation Errors

ValueDescription
BACKEND_CALC_ERRORThe backend encountered an error during computation
ERR_UNSUPPORT_BACKEND_TYPEThe specified backend type is not supported
ERR_QVM_INIT_FAILEDQuantum virtual machine initialization failed
ERR_QCOMPILER_FAILEDThe quantum compiler encountered an error
CLUSTER_SIMULATE_CALC_ERRCluster simulation computation failed
CLUSTER_BASEBase cluster error

Resource Limit Errors

ValueDescription
ERR_TASK_BUF_OVERFLOWTask buffer overflow; too many tasks queued
EXCEED_MAX_QUBITThe program exceeds the maximum number of qubits supported by the chip
EXCEED_MAX_CLOCKThe program exceeds the maximum circuit depth (clock cycles) allowed
ERR_SUB_GRAPH_OUT_OF_RANGEThe subgraph specification is out of the valid range
ERR_TASK_STATUS_BUF_OVERFLOWTask status buffer overflow
ERR_QPROG_LENGTHThe quantum program exceeds the maximum allowed length

Circuit and Compilation Errors

ValueDescription
ERR_PRE_ESTIMATEPre-estimation of circuit resources failed
ERR_MATE_GATE_CONFIGMate gate configuration error
ERR_FIDELITY_MATRIXFidelity matrix computation error
ERR_QST_PROGInvalid Quantum State Tomography program
ERR_EMPTY_PROGThe submitted quantum program is empty
ERR_QUBIT_SIZEInvalid qubit size specification
ERR_QUBIT_TOPOQubit topology error
ERR_QUANTUM_CHIP_PROGQuantum chip program error
ERR_REPEAT_MEASURERepeated measurement configuration error
ERR_OPERATOR_DBOperator database error

Task Management Errors

ValueDescription
ERR_UNKNOW_TASK_TYPEUnknown or unsupported task type
ERR_NOT_FOUND_APP_IDThe specified application ID was not found
ERR_NOT_FOUND_TASK_IDThe specified task ID was not found
ERR_PARSER_SUB_TASK_RESULTFailed to parse sub-task results
ERR_TASK_TERMINATEDThe task was terminated before completion

Network and Connection Errors

ValueDescription
ERR_SYS_CALL_TIME_OUTSystem call timed out
ERR_INVALID_URLThe provided URL is invalid
ERR_BACKEND_CHIP_TASK_SOCKET_WRONGBackend chip task socket error
ERR_TCP_INIT_FATLTTCP initialization failed
ERR_TCP_SERVER_HALTTCP server is halted or unreachable

Chip Availability

ValueDescription
ERR_CHIP_OFFLINEThe target quantum chip is currently offline
ERR_SCHEDULE_CHIP_TOPOLOGY_SUPPORTEDThe chip topology is not supported by the scheduler

General

ValueDescription
UNDEFINED_ERRORAn undefined or unrecognized error occurred

Examples

python
from pyqpanda3.pilot_service import QPilotService

service = QPilotService(url="https://qpilot.originquantum.cn", api_key="key")
task_id = service.async_run(prog, shot=1000)

# Query and check for errors
state, results, err_code, err_info = service.query_result(task_id)

if err_code == 0:  # NO_ERROR_FOUND
    print("Operation succeeded")
elif err_code == 1:  # ERR_CHIP_OFFLINE
    print("The chip is offline; try a different backend")
elif err_code == 2:  # EXCEED_MAX_QUBIT
    print("Program uses too many qubits for this chip")
elif err_code == 3:  # ERR_TASK_TERMINATED
    print("Task was terminated")
else:
    print(f"Error {err_code}: {err_info}")

See Also

Released under the MIT License.