{
  "id": "python/flask-assertionerror-view-function-mapping",
  "signature": "AssertionError: View function mapping is overwriting an existing endpoint function: main",
  "signature_zh": "AssertionError: 视图函数映射正在覆盖现有的端点函数：main",
  "regex": "AssertionError:\\ View\\ function\\ mapping\\ is\\ overwriting\\ an\\ existing\\ endpoint\\ function:\\ main",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "Two different view functions are registered with the same endpoint name or route.",
  "root_cause_type": "generic",
  "root_cause_zh": "两个不同的视图函数使用相同的端点名称或路由注册。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Changing function name without changing endpoint",
      "why_fails": "Flask uses endpoint, not function name, for uniqueness.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using same route for GET and POST without specifying methods",
      "why_fails": "Can cause conflict if both are same function.",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use unique endpoint names",
      "success_rate": 0.95,
      "how": "@app.route('/home', endpoint='home')\ndef home():\n    return 'Home'\n@app.route('/main', endpoint='main')\ndef main():\n    return 'Main'",
      "condition": "",
      "sources": []
    },
    {
      "action": "Combine routes with different methods",
      "success_rate": 0.9,
      "how": "@app.route('/data', methods=['GET'])\ndef get_data():\n    return 'GET'\n@app.route('/data', methods=['POST'])\ndef post_data():\n    return 'POST'",
      "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-04-30",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}