Skip to content

Troubleshooting

Common errors, debugging tips, and solutions for the Open Quantum PennyLane plugin.

Common Errors

Authentication Error (HTTP 401)

Symptom: OpenQuantumDeviceError with an HTTP 401 status code, or an APIError indicating authentication failure.

Causes and solutions:

  • Invalid SDK key credentials. Verify that your client_id and client_secret are correct. Client IDs start with s_.
  • Environment variables not set. Check that OPENQUANTUM_CLIENT_ID and OPENQUANTUM_CLIENT_SECRET are set in your current shell session.
  • SDK key is disabled. Log in to the Open Quantum Portal and check that your SDK key is enabled on the SDK Keys page.
  • SDK key was deleted. Create a new SDK key in the portal.
# Verify environment variables are set
echo $OPENQUANTUM_CLIENT_ID
echo $OPENQUANTUM_CLIENT_SECRET

Authorization Error (HTTP 403)

Symptom: OpenQuantumDeviceError with an HTTP 403 status code.

This means the JWT is valid but the user does not have access to the specified organization. Verify that your organization_id is correct and that your user account is a member of that organization.


Insufficient Credits Error (HTTP 402)

Symptom: OpenQuantumDeviceError with an HTTP 402 status code, or an error message indicating insufficient credits.

Solutions:

  • Check your credit balance on your Account page.
  • Reduce the number of shots to lower the job cost.
  • Choose a backend with lower per-shot costs.
  • Purchase additional credits through the portal (via Stripe).
  • If using a Private execution plan, ensure you have Full credits (Spark credits only work with the Public plan).

Active Job Limit Error (HTTP 409)

Symptom: OpenQuantumDeviceError with an HTTP 409 status code, or an error message indicating the active job limit has been reached.

Your organization has reached the maximum of 10 active jobs (jobs in Created, Pending, Queued, or Running status).

Solutions:

  • Wait for currently running jobs to complete.
  • Cancel pending jobs you no longer need from the portal.
  • Check active jobs in the portal under Jobs, filtered by status.

Timeout Error

Symptom: OpenQuantumDeviceError: Operation timed out after 86400s

The job did not complete within the job_timeout_seconds window (default: 86400 seconds / 1 day).

Solutions:

  • Increase the timeout if needed: job_timeout_seconds=600 (10 minutes) or higher.
  • Check the job status in the portal -- the job may still be running.
  • QPU backends may have long queue times during peak usage. Consider choosing a backend with a shorter queue.
dev = qml.device(
    "openquantum.device",
    wires=2,
    shots=1024,
    backend="ionq:forte-1",
    job_timeout_seconds=600,  # Wait up to 10 minutes
)

"shots=None is not supported"

Symptom: Error when creating a device with shots=None

Open Quantum is a shot-based execution platform. Analytic mode is not supported.

Solution: Always specify a positive integer for shots:

# Incorrect
dev = qml.device("openquantum.device", wires=2, shots=None, backend="ionq:forte-1")

# Correct
dev = qml.device("openquantum.device", wires=2, shots=1024, backend="ionq:forte-1")

QASM Validation Errors

Symptom: Job preparation fails with a validation error message.

Common causes:

  • Unsupported gate: The circuit uses a gate that cannot be decomposed into the supported gate set. Check Supported Operations.
  • Too many qubits: The circuit uses more qubits than the backend supports. Check the backend's max_qubits constraint.
  • Empty circuit: The circuit has no operations.

Tip

PennyLane automatically decomposes unsupported gates into supported ones. If you still get a QASM error, the gate may not have a valid decomposition path to the supported set.


Connection Errors

Symptom: OpenQuantumDeviceError or connection error when attempting to authenticate.

Solutions:

  • Check your internet connection.
  • Verify that https://www.openquantum.com is accessible from your network.
  • If you are behind a corporate firewall or proxy, configure your environment accordingly.

Debugging Tips

Enable the PennyLane Tracker

Use PennyLane's device tracker to monitor circuit executions:

dev = qml.device("openquantum.device", wires=2, shots=1024, backend="ionq:forte-1")

@qml.qnode(dev)
def circuit():
    qml.Hadamard(wires=0)
    qml.CNOT(wires=[0, 1])
    return qml.counts()

with qml.Tracker(dev) as tracker:
    result = circuit()

print(f"Executions: {tracker.totals['executions']}")
print(f"Shots: {tracker.totals['shots']}")

Check Job Status in the Portal

If a job seems stuck or fails unexpectedly:

  1. Log in to the Open Quantum Portal.
  2. Navigate to Jobs.
  3. Find your job by timestamp or filter by status.
  4. Check the job's status and any error messages.

Verify QASM Output

To inspect the QASM that the plugin generates, you can serialize a tape manually:

import pennylane as qml
from pennylane_openquantum.qasm_serializer import circuit_to_qasm

with qml.tape.QuantumTape() as tape:
    qml.Hadamard(wires=0)
    qml.CNOT(wires=[0, 1])

qasm = circuit_to_qasm(tape, num_wires=2)
print(qasm)

Expected output:

OPENQASM 2.0;
include "qelib1.inc";
qreg q[2];
creg c[2];
h q[0];
cx q[0],q[1];
measure q[0] -> c[0];
measure q[1] -> c[1];

Getting Help

If you cannot resolve your issue: