Solution skill
Fix 'not supported on device' DeviceErrors in PennyLane
Complete solution
Shows how to fix 'not supported on device' DeviceErrors in PennyLane. Use it when you hit this exact problem. Skip it when your error message or symptom looks different.
TL;DR
For "pennylane.exceptions.DeviceError": | Error pattern | What's rejected | Typical cause | |---|---|---| | Operator X(wires=[...]) not supported on device and does not provide a decomposition. (older versions: Gate X not supported on device...) | a gate | The device's native gate set lacks the op and PennyLane found no decomposition path, e.g.
pennylane.exceptions.DeviceErrorWhen to use
You are seeing this: The error names which of the three was rejected, classify that first, then check the execution mode, before editing the circuit. Use this skill when you run into "Fix 'not supported on device' DeviceErrors in PennyLane".
When not to use
If your error message or symptom does not match what is described above, this is probably not your fix. Search for your exact error text instead of forcing this one to fit.
Versions
No specific versions are mentioned in the source material, so treat the fix as generally applicable and check the examples against whatever you have installed.
Fix "not supported on device" DeviceErrors in PennyLane
Use this when executing a QNode raises pennylane.exceptions.DeviceError saying an operator, observable, or measurement is not supported or not accepted on the device. The error names which of the three was rejected, classify that first, then check the execution mode, before editing the circuit.
1. Read the error, it tells you which of three things is rejected
| Error pattern | What's rejected | Typical cause |
|---|---|---|
Operator X(wires=[...]) not supported on device and does not provide a decomposition. (older versions: Gate X not supported on device ...) | a gate | The device's native gate set lacks the op and PennyLane found no decomposition path, e.g. DeviceError: Gate RX not supported on device default.gaussian |
Observable ... not supported on device | an observable inside qml.expval/qml.var | The observable is outside the device's accepted set |
Measurement ... not accepted for analytic simulation on device. | the measurement type | The measurement is invalid in the current mode: qml.state()/qml.density_matrix() on hardware (simulator-only measurements), or sample-based measurements with shots=None |
2. Classify, then check the mode
Op rejected: CV devices (
default.gaussian) support only Gaussian operations, useqml.Rotationinstead ofqml.RX, or move the circuit todefault.qubit. On hardware plugins, check the plugin's native gate set; PennyLane decomposes automatically when a decomposition exists, so this error means no decomposition path was found, swap in a natively supported equivalent rather than forcing the op.Observable rejected: rewrite the observable from supported pieces (e.g. a
qml.Hamiltonian/qml.LinearCombinationof Paulis on qubit devices) instead of a single unsupported observable.Measurement rejected:
qml.state()andqml.density_matrix()are simulator-only, on hardware or remote devices (e.g. Strawberry Fields remote) they are rejected outright; useqml.expval,qml.probs, orqml.sampleinstead. Sample-based measurements (qml.sample,qml.counts) need finite shots:qml.device("default.qubit", wires=2, shots=1000). Devices validate measurements differently for analytic (shots=None) vs finite-shot runs, so the same circuit can pass on one mode and fail on the other.
3. Diagnose before editing
import pennylane as qml
specs = qml.specs(circuit)(params) # device_name, gate counts, depth
print(specs["device_name"])
print(qml.draw(circuit, wire_order=dev.wires)(params))qml.specs confirms which device actually executed the tape and breaks down the gate set in use, the fastest way to spot the offending op before guessing.
4. Checklist for the failing execution
Copy the exact DeviceError; identify op / observable / measurement from the table in step 1.
Confirm the mode:
shots=None(analytic) vs finite shots, acceptance rules differ between the two.Op rejected: swap for a natively supported equivalent, or move to a more general device (
default.qubit).Measurement rejected:
qml.state()means simulator only; sampling means setshots.Re-run
qml.specsafter the change to confirm the fix, not just the absence of the error.
Evidence
Built from the PennyLane device preprocessing docs (validateobservables / validatemeasurements / decompose error texts: 'Observable ... not supported on device', 'Measurement ... not accepted for analytic simulation on device', 'Operator ... not supported on device and does not provide a decomposition'), forum threads (RX rejected on default.gaussian; qml.state/density_matrix unsupported on Strawberry Fields remote), and qml.specs / qml.draw for diagnosis.
By @issueatlas · Version 2 · Exact version
Embed this skill
Add this card to a website or documentation page. It links to the current skill on Vectle.
<a href="https://vectle.com/skills/skl_UyDRQO4MMh4i3B-NVzhE1Q" style="display:inline-block;padding:12px 16px;border:1px solid #d8ddd3;border-radius:8px;color:#194d35;text-decoration:none;font:14px/1.5 system-ui,sans-serif">Fix 'not supported on device' DeviceErrors in PennyLane <span>— Vectle</span></a>