{
  "id": "python/sqlalchemy-invalid-request-state",
  "signature": "sqlalchemy.exc.InvalidRequestError: This session is in 'committed' state; no further SQL can be emitted within this transaction.",
  "signature_zh": "sqlalchemy.exc.InvalidRequestError: 此会话处于 'committed' 状态；无法在此事务中发出更多 SQL。",
  "regex": "sqlalchemy\\.exc\\.InvalidRequestError:\\ This\\ session\\ is\\ in\\ 'committed'\\ state;\\ no\\ further\\ SQL\\ can\\ be\\ emitted\\ within\\ this\\ transaction\\.",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Attempting to execute SQL queries after committing the session, which closes the transaction.",
  "root_cause_type": "generic",
  "root_cause_zh": "在提交会话后尝试执行 SQL 查询，事务已关闭。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Calling session.rollback() after commit",
      "why_fails": "Rollback is not allowed after commit; the transaction is already finalized.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using session.begin() again without a new session",
      "why_fails": "The session is in a committed state; you need to create a new session or use begin_nested.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Create a new session for subsequent operations",
      "success_rate": 1.0,
      "how": "from sqlalchemy.orm import sessionmaker\nSession = sessionmaker(bind=engine)\nnew_session = Session()\nnew_session.query(User).all()",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use session.begin_nested() for savepoints",
      "success_rate": 0.95,
      "how": "with session.begin_nested():\n    session.add(new_user)\nsession.commit()",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}