Skip to content

ForLoopOp with reused Parameter causes "circuit parameter table is inconsistent" on assign_parameters #15657

@huhu37

Description

@huhu37

Environment

  • Qiskit version: 2.3.0
  • Python version: 3.11.14
  • Operating system: Ubuntu 24.04.3

What is happening?

When using qiskit.circuit.controlflow.ForLoopOp, calling QuantumCircuit.assign_parameters on the outer circuit raises a runtime error:
RuntimeError: internal error: circuit parameter table is inconsistent,
while the same code executes without error in Qiskit version 2.2.3.

How can we reproduce the issue?

from qiskit.circuit import QuantumCircuit, Parameter
from qiskit.circuit.controlflow import ForLoopOp

theta = Parameter('θ')
body = QuantumCircuit(1)
body.rx(theta, 0)
indexset = range(3)
loop_parameter = theta
for_loop_op = ForLoopOp(indexset, loop_parameter, body)
qc = QuantumCircuit(1)
qc.append(for_loop_op, [0])
# This line triggers the error
qc.assign_parameters({theta: 3.14159 / 2}, inplace=True)

What should happen?

The parameter assignment succeeds, correctly binding theta throughout the circuit, or a clear user-facing error is raised earlier.

Any suggestions?

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions