{
  "id": "python/fastapi-route-order-matters",
  "signature": "fastapi.exceptions.FastAPIError: Duplicate parameter name: 'path' in function 'catch_all'",
  "signature_zh": "FastAPI错误：函数中参数名重复",
  "regex": "fastapi\\.exceptions\\.FastAPIError:\\ Duplicate\\ parameter\\ name:\\ 'path'\\ in\\ function\\ 'catch_all'",
  "domain": "python",
  "category": "config_error",
  "subcategory": null,
  "root_cause": "Defining a catch-all route like `@app.get('/{path}')` after specific routes can cause FastAPI to interpret path parameters incorrectly, leading to duplicate parameter errors or wrong matching.",
  "root_cause_type": "generic",
  "root_cause_zh": "在特定路由之后定义通配路由（如`@app.get('/{path}')`）可能导致FastAPI错误解释路径参数，引发重复参数错误或错误匹配。",
  "versions": [
    {
      "version": "3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Reordering routes doesn't fix the duplicate parameter error if the catch-all is too broad.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Using a different parameter name in the catch-all still conflicts with other routes.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Define specific routes before catch-all routes, and ensure catch-all uses a distinct parameter name like `{path:path}` with a converter.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Use `@app.api_route('/{path}', methods=['GET'], include_in_schema=False)` for catch-all to avoid conflicts.",
      "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.84,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}