{
  "id": "python/flask-session-cookie-not-signed",
  "signature": "RuntimeError: The session is unavailable because no secret key was set.  Please set the secret key on the application to something unique and secret.",
  "signature_zh": "运行时错误：未设置密钥导致会话不可用",
  "regex": "RuntimeError:\\ The\\ session\\ is\\ unavailable\\ because\\ no\\ secret\\ key\\ was\\ set\\.\\ \\ Please\\ set\\ the\\ secret\\ key\\ on\\ the\\ application\\ to\\ something\\ unique\\ and\\ secret\\.",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "Flask applications using sessions must set a secret key via `app.secret_key`; without it, session operations raise a RuntimeError.",
  "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": "",
      "why_fails": "Setting `app.config['SECRET_KEY']` after the first request doesn't help; it must be set before any session is used.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Using an empty string as secret key still raises the error because Flask checks for truthiness.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 1.0,
      "how": "Set `app.secret_key = 'your-secret-key'` in your app creation code, preferably from environment variables: `import os; app.secret_key = os.environ.get('SECRET_KEY', 'dev-key')`.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.95,
      "how": "If using an app factory, set it in `create_app()` before returning the app.",
      "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.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-02-01",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}