{
  "id": "python/flask-missing-secret-key",
  "signature": "RuntimeError: The session is unavailable because no secret key was set. Set the secret_key on the application to something unique and secret.",
  "signature_zh": "运行时错误：会话不可用，因为未设置密钥。请在应用程序上设置一个唯一且保密的secret_key。",
  "regex": "RuntimeError:\\ The\\ session\\ is\\ unavailable\\ because\\ no\\ secret\\ key\\ was\\ set\\.\\ Set\\ the\\ secret_key\\ on\\ the\\ application\\ to\\ something\\ unique\\ and\\ secret\\.",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "Flask requires a secret key to use sessions. If app.secret_key is not set, session operations fail.",
  "root_cause_type": "generic",
  "root_cause_zh": "Flask 需要使用密钥来支持会话。如果未设置 app.secret_key，会话操作会失败。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Setting secret_key to an empty string",
      "why_fails": "An empty string is not considered a valid secret key.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using app.config['SECRET_KEY'] = 'mysecret' after first session access",
      "why_fails": "The secret key must be set before the first session usage.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Set secret_key on the Flask app instance",
      "success_rate": 0.95,
      "how": "app.secret_key = 'your-secret-key'",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use os.urandom to generate a secure key",
      "success_rate": 0.95,
      "how": "import os\napp.secret_key = os.urandom(24)",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-03-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}