{"record":{"id":"3f6625f3c50c58a2","repo":"rohitg00/ai-engineering-from-scratch","slug":"mutation-counter-is-missing","errorCode":null,"errorMessage":"mutation counter is missing","messagePattern":"mutation counter is missing","errorType":"exception","errorClass":"ReliabilityError","httpStatus":null,"severity":"error","filePath":"phases/13-tools-and-protocols/29-mcp-reliability-cancellation-and-flow-control/code/main.py","lineNumber":362,"sourceCode":"                        FROM idempotency_records\n                        WHERE idempotency_key = ?\n                        \"\"\",\n                        (idempotency_key,),\n                    ).fetchone()\n                    if stored is not None:\n                        stored_fingerprint, stored_json = stored\n                        if stored_fingerprint != fingerprint:\n                            raise ReliabilityError(\n                                \"idempotency key was reused with different arguments\"\n                            )\n                        self._connection.execute(\"COMMIT\")\n                        return json.loads(stored_json)\n\n                row = self._connection.execute(\n                    \"SELECT executions FROM mutation_counter WHERE singleton = 1\"\n                ).fetchone()\n                if row is None:\n                    raise ReliabilityError(\"mutation counter is missing\")\n                execution_number = int(row[0]) + 1\n                result = {\n                    \"receipt\": f\"charge-{execution_number:03d}\",\n                    \"rpcId\": rpc_id,\n                    \"account\": account,\n                    \"cents\": cents,\n                }\n                result_json = json.dumps(\n                    result,\n                    sort_keys=True,\n                    separators=(\",\", \":\"),\n                )\n                self._connection.execute(\n                    \"UPDATE mutation_counter SET executions = ? WHERE singleton = 1\",\n                    (execution_number,),\n                )\n                if idempotency_key is not None:\n                    self._connection.execute(","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/rohitg00/ai-engineering-from-scratch/blob/39ea8a1c6d0b61f071226eff7ede4d4105fed820/phases/13-tools-and-protocols/29-mcp-reliability-cancellation-and-flow-control/code/main.py#L344-L380","documentation":"Error \"mutation counter is missing\" thrown in rohitg00/ai-engineering-from-scratch.","triggerScenarios":"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.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"39ea8a1c6d0b61f071226eff7ede4d4105fed820","analyzedAt":"2026-08-26T03:13:46.626Z","schemaVersion":2},"datasetVersion":"2026-08-26T07:17:17.940Z"}