{
  "id": "react/error-minified-react-error-329",
  "signature": "Minified React error #329; visit https://reactjs.org/docs/error-decoder.html?invariant=329 for the full message or use the non-minified dev environment for full errors.",
  "signature_zh": "Minified React error #329; 访问 https://reactjs.org/docs/error-decoder.html?invariant=329 获取完整消息，或使用非压缩的开发环境查看完整错误。",
  "regex": "Minified React error #329",
  "domain": "react",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "React's internal invariant violation #329 indicates a state update was called on a component that is not mounted, typically due to an asynchronous operation (e.g., setTimeout, fetch) completing after the component unmounts.",
  "root_cause_type": "generic",
  "root_cause_zh": "React 内部不变性违反 #329 表示状态更新被调用在一个已卸载的组件上，通常是由于异步操作（例如 setTimeout、fetch）在组件卸载后完成。",
  "versions": [
    {
      "version": "React 18.2.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "React 17.0.2",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "React 16.14.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Use componentWillUnmount lifecycle method in a function component",
      "why_fails": "Function components do not have componentWillUnmount; you must use useEffect cleanup instead.",
      "fail_rate": 1.0,
      "condition": "",
      "sources": []
    },
    {
      "action": "Add a try-catch around the state update call",
      "why_fails": "The error is not a thrown exception; it's an invariant violation that bypasses try-catch.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Call setState with a callback to ensure it's executed after the update",
      "why_fails": "setState callbacks don't prevent updates on unmounted components.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use a cleanup function in useEffect to cancel asynchronous operations. Example: useEffect(() => { const controller = new AbortController(); fetch(url, { signal: controller.signal }); return () => controller.abort(); }, []);",
      "success_rate": 0.9,
      "how": "Use a cleanup function in useEffect to cancel asynchronous operations. Example: useEffect(() => { const controller = new AbortController(); fetch(url, { signal: controller.signal }); return () => controller.abort(); }, []);",
      "condition": "",
      "sources": []
    },
    {
      "action": "Check if the component is mounted using a ref before calling setState. Example: const isMounted = useRef(true); useEffect(() => { return () => { isMounted.current = false; }; }, []); then check if (isMounted.current) before setState.",
      "success_rate": 0.85,
      "how": "Check if the component is mounted using a ref before calling setState. Example: const isMounted = useRef(true); useEffect(() => { return () => { isMounted.current = false; }; }, []); then check if (isMounted.current) before setState.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a state management library like Zustand or Redux that handles updates outside the component lifecycle, avoiding direct setState calls.",
      "success_rate": 0.75,
      "how": "Use a state management library like Zustand or Redux that handles updates outside the component lifecycle, avoiding direct setState calls.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Use a cleanup function in useEffect to cancel asynchronous operations. Example: useEffect(() => { const controller = new AbortController(); fetch(url, { signal: controller.signal }); return () => controller.abort(); }, []);",
    "Check if the component is mounted using a ref before calling setState. Example: const isMounted = useRef(true); useEffect(() => { return () => { isMounted.current = false; }; }, []); then check if (isMounted.current) before setState.",
    "Use a state management library like Zustand or Redux that handles updates outside the component lifecycle, avoiding direct setState calls."
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://reactjs.org/docs/error-decoder.html?invariant=329",
  "official_doc_section": null,
  "error_code": "329",
  "verification_tier": "ai_generated",
  "confidence": 0.83,
  "fix_success_rate": 0.87,
  "resolvable": "true",
  "first_seen": "2023-11-20",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}