{
  "id": "nextjs/server-action-redirect-external",
  "signature": "Error: Server Actions cannot redirect to external URLs. Use NextResponse.redirect() instead.",
  "signature_zh": "错误：服务器操作无法重定向到外部 URL。请改用 NextResponse.redirect()。",
  "regex": "Server Actions cannot redirect to external URLs",
  "domain": "nextjs",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Server Actions use the 'use server' directive and can only redirect to internal routes using redirect(). External URLs require a different approach, such as NextResponse.redirect() in middleware or a client-side redirect.",
  "root_cause_type": "generic",
  "root_cause_zh": "服务器操作使用 'use server' 指令，只能通过 redirect() 重定向到内部路由。外部 URL 需要不同的方法，例如在中间件中使用 NextResponse.redirect() 或客户端重定向。",
  "versions": [
    {
      "version": "next@14.2.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "next@15.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Server Actions run on the server; window is not defined, causing a ReferenceError.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This adds complexity and may not work with Next.js error boundaries, leading to unhandled rejections.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Return a redirect URL from the Server Action and handle the redirect on the client side using useRouter or window.location.",
      "success_rate": 0.9,
      "how": "Return a redirect URL from the Server Action and handle the redirect on the client side using useRouter or window.location.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use NextResponse.redirect() in middleware with a custom header set by the Server Action.",
      "success_rate": 0.8,
      "how": "Use NextResponse.redirect() in middleware with a custom header set by the Server Action.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "从服务器操作返回重定向 URL，并在客户端使用 useRouter 或 window.location 处理重定向。",
    "在中间件中使用 NextResponse.redirect()，并通过服务器操作设置的自定义 header 触发。"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://nextjs.org/docs/app/api-reference/functions/server-actions#redirecting",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.9,
  "resolvable": "true",
  "first_seen": "2024-08-05",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}