rohitg00/ai-engineering-from-scratch · error · ReliabilityError

mutation counter is missing

Error message

mutation counter is missing

What it means

Error "mutation counter is missing" thrown in rohitg00/ai-engineering-from-scratch.

Source

Thrown at phases/13-tools-and-protocols/29-mcp-reliability-cancellation-and-flow-control/code/main.py:362

                        FROM idempotency_records
                        WHERE idempotency_key = ?
                        """,
                        (idempotency_key,),
                    ).fetchone()
                    if stored is not None:
                        stored_fingerprint, stored_json = stored
                        if stored_fingerprint != fingerprint:
                            raise ReliabilityError(
                                "idempotency key was reused with different arguments"
                            )
                        self._connection.execute("COMMIT")
                        return json.loads(stored_json)

                row = self._connection.execute(
                    "SELECT executions FROM mutation_counter WHERE singleton = 1"
                ).fetchone()
                if row is None:
                    raise ReliabilityError("mutation counter is missing")
                execution_number = int(row[0]) + 1
                result = {
                    "receipt": f"charge-{execution_number:03d}",
                    "rpcId": rpc_id,
                    "account": account,
                    "cents": cents,
                }
                result_json = json.dumps(
                    result,
                    sort_keys=True,
                    separators=(",", ":"),
                )
                self._connection.execute(
                    "UPDATE mutation_counter SET executions = ? WHERE singleton = 1",
                    (execution_number,),
                )
                if idempotency_key is not None:
                    self._connection.execute(

View on GitHub (pinned to 39ea8a1c6d)

When it happens

Trigger: Thrown at phases/13-tools-and-protocols/29-mcp-reliability-cancellation-and-flow-control/code/main.py:362 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of rohitg00/ai-engineering-from-scratch@39ea8a1c6d (2026-08-26). Data as JSON: /api/errors/3f6625f3c50c58a2. Report an issue: GitHub.