{
  "id": "python/flask-secret-key-required",
  "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": "RuntimeError: 会话不可用，因为未设置密钥。请为应用设置唯一且保密的 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 session (or CSRF) requires app.secret_key but it was never configured, often in tests or a fresh deploy.",
  "root_cause_type": "generic",
  "root_cause_zh": "Flask 会话（或 CSRF）需要 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": "Permanence affects cookie lifetime, not the required signing key.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Most session backends still need a secret key for signing.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Set a secret key from environment:\napp.config['SECRET_KEY'] = os.environ['SECRET_KEY']",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "For tests only, generate a fixed key:\napp.config['SECRET_KEY'] = 'test-key'",
      "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-01-19",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}