Troubleshooting¶
Authentication required¶
AuthenticationError: Authentication required. Provide a token or
client_id+client_secret (or OPENQUANTUM_TOKEN / OPENQUANTUM_CLIENT_ID +
OPENQUANTUM_CLIENT_SECRET / OPENQUANTUM_SDK_KEY).
No credentials were found. OpenQuantumSampler calls OpenQuantumClient.from_env(). Set OPENQUANTUM_CLIENT_ID and OPENQUANTUM_CLIENT_SECRET, set OPENQUANTUM_TOKEN or OPENQUANTUM_SDK_KEY, or pass token=, client_id= + client_secret=, or a pre-built client=. See Authentication.
Circuit has no measurement gates¶
CircuitValidationError: Circuit has no measurement gates; add cirq.measure(...)
before sampling on the Open Quantum platform.
The Open Quantum platform is shot-based and Cirq's QASM exporter does not add measurements. Append a measurement to your circuit:
configuration_data validation failed: ... required property 'engine'¶
qr:sim requires an engine. The defaults are Scarlet, double precision, and
automatic performance:
sampler = OpenQuantumSampler(
backend="qr:sim",
configuration_data={
"engine": "SCARLET_CPU",
"precision": "DOUBLE",
"performance": "AUTOMATIC",
},
)
configuration_data validation failed: ... must match "else" schema¶
qr:sim only permits threshold when performance is CUSTOM. Send it only
then:
# Valid: automatic performance does not take a threshold
configuration_data={
"engine": "SCARLET_CPU",
"precision": "DOUBLE",
"performance": "AUTOMATIC",
}
# Valid: threshold is allowed because performance is CUSTOM
configuration_data={
"engine": "SCARLET_CPU",
"performance": "CUSTOM",
"threshold": 128,
}
Results look bit-reversed¶
The Open Quantum platform returns counts little-endian (first classical bit rightmost),
while Cirq is big-endian. The Open Quantum sampler reverses bitstrings by default
(reverse_bits=True) so the mapping is correct. If a particular backend returns
counts big-endian and your results look reversed, construct the sampler with
reverse_bits=False. Confirm with an asymmetric state: apply X to one qubit
and check which bit flips.
to_qasm raised on an unsupported gate¶
Cirq could not express an operation in OpenQASM. Decompose it before sampling:
Shots are required¶
Open Quantum is shot-based; analytic execution is not supported. Pass
repetitions= to run / sample / run_sweep. For local state-vector
simulation use cirq.Simulator instead.
Backend is offline or not accepting jobs¶
Pick another backend. List what is online with the
Core SDK (client.backends(online=True))
or the Open Quantum Portal.
Organization could not be resolved¶
If your account belongs to more than one organization, pass an explicit
organization_id to the sampler (discover it via client.organizations()).