cirq.Simulator fails to handle measurements within looped circuit operations, but EngineSampler does

Open
#8,410 10 comments 0 reactions 1 assignee View on GitHub

Maintainers usually reply within 1 day

@mhucka is already working on this.

Since Oct 5, 2026.

Assessment

This issue has not been assessed yet.

Description

area/google/engine area/measurements area/simulation kind/bug-report priority/before-1.8 skill/expert

To reproduce:

import cirq
import stim
import stimcirq

stim_circuit = stim.Circuit.generated(
    "repetition_code:memory",
    rounds=5,
    distance=3
)
circuit = stimcirq.stim_circuit_to_cirq_circuit(stim_circuit)
result = cirq.Simulator().run(circuit)
result.data

This throws

ValueError: Cannot extract 2D measurements for repeated keys

However, similar circuits can be run through cirq_google.EngineSampler. See this example.

Dominant language
Python
Stars
5.1k
Forks
1.3k
Avg merge
1d 12h
Merged PRs (30d)
48

Getting set up

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 quantumlib/Cirq

All issues in quantumlib/Cirq

Similar issues

More Python issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.