[Bug] Parameters from a previous circuit persist after create_empty_circuit() and block execution

Open
#1,536 1 comment 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 2 days

@Howardisme is already working on this.

Since Oct 18, 2026.

  • #1537 by @Howardisme — open

Assessment

Difficulty
2/5
Estimated time
1-3 hours
Newbie friendliness
35/100
Issue type
Bug
Clarity
Clearly specified
Activity status
Stale
Tech stack
python, rust
Domain
backend, testing

Research direction

Start with qumat/qumat.py, at QuMat.create_empty_circuit, and inspect how self.parameters is initialized and used by execute_circuit() and get_final_state_vector(). The issue reports an open linked pull request (#1537), so check its status before starting. Done means a fresh circuit executes without parameters left over from the previous circuit, with coverage for Qiskit, Cirq, and Amazon Braket.

Written by the indexing model from the issue text.

Description

bug enhancement
What

QuMat.create_empty_circuit() replaces self.circuit but keeps self.parameters. Parameter names registered on the previous circuit stay in the dict with value None, so a new circuit with no parameterized gates cannot be executed:

from qumat import QuMat

qm = QuMat({"backend_name": "cirq", "backend_options": {"shots": 10}})
qm.create_empty_circuit(1)
qm.apply_rx_gate(0, "a")

qm.create_empty_circuit(1)  # fresh circuit, no parameterized gates
qm.execute_circuit()
# ValueError: Circuit contains unbound parameters: ['a']. Please provide parameter_values when executing the circuit.

Actual result: execute_circuit() and get_final_state_vector() both raise ValueError on all three backends (Qiskit, Cirq, Amazon Braket). qm.parameters is still {'a': None} after create_empty_circuit().

Expected result: create_empty_circuit() starts from a clean state, so parameters registered on an earlier circuit do not carry over to the new one.

Where: qumat/qumat.py (QuMat.create_empty_circuit). Resetting self.parameters there should fix it; a test should cover all backends.

Environment
  • OS: macOS 26.6.2
  • Python version: 3.12.15
  • Qumat version: 0.7.0.dev0 (main at 37cf3878c)
Dominant language
Rust
Stars
2.3k
Forks
1k
Avg merge
2d 20h
Merged PRs (30d)
7

Getting set up

Open in Codespaces

Starts the project's dev container in your browser, under your own GitHub account.

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from apache/mahout

All issues in apache/mahout

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.