{
  "id": "go/net-http-flusher-not-available",
  "signature": "http: ResponseWriter does not implement http.Flusher",
  "signature_zh": "http：ResponseWriter 未实现 http.Flusher",
  "regex": "http: ResponseWriter does not implement http\\.Flusher",
  "domain": "go",
  "category": "type_error",
  "subcategory": null,
  "root_cause": "Using http.Flusher on a ResponseWriter that wraps or replaces the original object, such as when using a custom middleware that doesn't preserve the Flusher interface.",
  "root_cause_type": "generic",
  "root_cause_zh": "在包装或替换原始对象的 ResponseWriter 上使用 http.Flusher，例如使用未保留 Flusher 接口的自定义中间件时。",
  "versions": [
    {
      "version": "Go 1.15",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Go 1.16",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Go 1.17",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Go 1.18",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Go 1.19",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Go 1.20",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Go 1.21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Go 1.22",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "Go 1.23",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "The assertion fails because the wrapper replaces the original writer; you must assert on the wrapper.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The original writer supports Flusher, but the wrapper doesn't pass it through; pre-check doesn't help.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Flushing is critical for streaming responses; ignoring it breaks functionality like SSE or chunked transfer.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Implement Flusher interface in your custom ResponseWriter wrapper by embedding the original writer and forwarding Flush()",
      "success_rate": 0.95,
      "how": "Implement Flusher interface in your custom ResponseWriter wrapper by embedding the original writer and forwarding Flush()",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use http.ResponseController from Go 1.20+ to enable flush without direct Flusher assertion",
      "success_rate": 0.9,
      "how": "Use http.ResponseController from Go 1.20+ to enable flush without direct Flusher assertion",
      "condition": "",
      "sources": []
    },
    {
      "action": "Avoid wrapping ResponseWriter if possible; modify the handler to flush via the original writer before wrapping",
      "success_rate": 0.8,
      "how": "Avoid wrapping ResponseWriter if possible; modify the handler to flush via the original writer before wrapping",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Implement Flusher interface in your custom ResponseWriter wrapper by embedding the original writer and forwarding Flush()",
    "Use http.ResponseController from Go 1.20+ to enable flush without direct Flusher assertion",
    "Avoid wrapping ResponseWriter if possible; modify the handler to flush via the original writer before wrapping"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://pkg.go.dev/net/http#Flusher",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.85,
  "resolvable": "true",
  "first_seen": "2023-09-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}