{
  "id": "python/flask-config-keyerror",
  "signature": "KeyError: 'SECRET_KEY'",
  "signature_zh": "KeyError：'SECRET_KEY'",
  "regex": "KeyError:\\ 'SECRET_KEY'",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "Accessing a configuration key that is not set in the Flask app config.",
  "root_cause_type": "generic",
  "root_cause_zh": "访问未在 Flask 应用配置中设置的配置键。",
  "versions": [
    {
      "version": "2.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Uses insecure default; doesn't solve missing config.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Insecure for production.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "app.config['SECRET_KEY'] = os.environ.get('SECRET_KEY')",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "class Config:\n    SECRET_KEY = '...'\napp.config.from_object(Config)",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-08-10",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}