I'm using Qiskit 1.0.0.

I'm trying to define a custom gate from a certain wavefunction and insert it in a quantum circuit that I want to run and measure the counts.

The relevant code for the question is as follows:

backend = FakePerth()
custom_gate_ch1 = Gate('ch1', 1, [])
circ = QuantumCircuit(4)
passmanager = generate_preset_pass_manager(optimization_level=1, backend=backend)

with builder.build() as ch1_gate:
    builder.play(wave, DriveChannel(0))

    {(0,): InstructionProperties(calibration=ch1_gate)},

circ.append(custom_gate_ch1, [0])
circ = passmanager.run(circ)

tqc = transpile(circ, backend, scheduling_method='asap')
counts = backend.run(tqc).result().get_counts()

With this code, I'm able to obtain the transpiled circuits correctly, but when I try to run it I get the following error:

qiskit.providers.basic_provider.exceptions.BasicProviderError: 'basic_simulator encountered unrecognized operation "ch1"'

Where am I going wrong?


1 Answer 1


have you found a solution? I think that there is nothing wrong in particular with your code. Just the transition to Qiskit 1.0.x did not happen as smoothly as hoped and not all functionality was kept.

I am facing the same issue with a sub-circuit including parameters for BasicSimulator. I found the solution by decomposing the circuit with abstract gates/circuits into the basic gate set before sending it to the BasicSimulator. Maybe it helps you.

decomposed = transpile(qc, basis_gates=['cx', 'id', 'rz', 'sx', 'x'])
backend = BasicSimulator()
job_results = backend.run(decomposed, shots=1).result()
  • $\begingroup$ As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center. $\endgroup$
    – Community Bot
    Mar 13 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.