{
  "id": "python/starlette-runtime-error-no-response-returned",
  "signature": "RuntimeError: No response returned.",
  "signature_zh": "RuntimeError: 未返回响应。",
  "regex": "RuntimeError:\\ No\\ response\\ returned\\.",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "An async view function does not return a valid response object.",
  "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": "Returning a string directly",
      "why_fails": "Starlette expects a Response object, not a string.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Forgetting return statement entirely",
      "why_fails": "Function returns None.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Return a Response object",
      "success_rate": 0.95,
      "how": "from starlette.responses import JSONResponse\nasync def handle(request):\n    return JSONResponse({'message': 'OK'})",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use PlainTextResponse for simple text",
      "success_rate": 0.9,
      "how": "from starlette.responses import PlainTextResponse\nasync def handle(request):\n    return PlainTextResponse('Hello')",
      "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": "2024-08-22",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}