{"record":{"id":"cf67244d640746fc","repo":"unclecode/crawl4ai","slug":"unsupported-operating-system","errorCode":null,"errorMessage":"Unsupported operating system","messagePattern":"Unsupported operating system","errorType":"exception","errorClass":"OSError","httpStatus":null,"severity":"error","filePath":"crawl4ai/utils.py","lineNumber":606,"sourceCode":"        class MEMORYSTATUSEX(ctypes.Structure):\n            _fields_ = [\n                (\"dwLength\", ctypes.c_ulong),\n                (\"dwMemoryLoad\", ctypes.c_ulong),\n                (\"ullTotalPhys\", c_ulonglong),\n                (\"ullAvailPhys\", c_ulonglong),\n                (\"ullTotalPageFile\", c_ulonglong),\n                (\"ullAvailPageFile\", c_ulonglong),\n                (\"ullTotalVirtual\", c_ulonglong),\n                (\"ullAvailVirtual\", c_ulonglong),\n                (\"ullAvailExtendedVirtual\", c_ulonglong),\n            ]\n\n        memoryStatus = MEMORYSTATUSEX()\n        memoryStatus.dwLength = ctypes.sizeof(MEMORYSTATUSEX)\n        kernel32.GlobalMemoryStatusEx(ctypes.byref(memoryStatus))\n        return memoryStatus.ullTotalPhys\n    else:\n        raise OSError(\"Unsupported operating system\")\n\n\ndef get_home_folder():\n    \"\"\"\n    Get or create the home folder for Crawl4AI configuration and cache.\n\n    How it works:\n    1. Uses environment variables or defaults to the user's home directory.\n    2. Creates `.crawl4ai` and its subdirectories (`cache`, `models`) if they don't exist.\n    3. Returns the path to the home folder.\n\n    Returns:\n        str: The path to the Crawl4AI home folder.\n    \"\"\"\n\n    home_folder = os.path.join(\n        os.getenv(\n            \"CRAWL4_AI_BASE_DIRECTORY\",","sourceCodeStart":588,"sourceCodeEnd":624,"githubUrl":"https://github.com/unclecode/crawl4ai/blob/7e801521428ee12509994d39151006f64055ebe3/crawl4ai/utils.py#L588-L624","documentation":"OSError from get_system_memory_configuration (implied by the surrounding ctypes code) when the platform is neither Windows (GlobalMemoryStatusEx) nor the other recognized branch (Linux reading /proc/meminfo). The function cannot query total physical memory on unrecognized platforms, so it refuses rather than guessing.","triggerScenarios":"Running crawl4ai's memory detection on an OS outside its platform branches — e.g. macOS only if unhandled in the version at hand, FreeBSD, or exotic environments where /proc is absent and ctypes kernel32 is unavailable.","commonSituations":"Deployments on unsupported/exotic platforms, Alpine or minimal containers without /proc mounted, or older crawl4ai versions whose platform coverage was narrower (newer releases added handlers; upgrading often fixes it).","solutions":["Upgrade crawl4ai — platform coverage for memory detection has expanded across releases.","On Linux containers, ensure /proc is mounted (it supplies meminfo).","As a caller, wrap the call and supply a conservative default memory value when detection fails, if your code tolerates it.","Report the platform to the project if a mainstream OS triggers it on the latest version."],"exampleFix":"# before\nfrom crawl4ai.utils import get_system_memory_configuration\ntotal = get_system_memory_configuration()  # OSError: Unsupported operating system\n\n# after\ntry:\n    total = get_system_memory_configuration()\nexcept OSError:\n    total = 4 * 1024**3  # fall back to a conservative 4 GB assumption\ntotal = get_system_memory_configuration()","handlingStrategy":"fallback","validationCode":"import platform\n\nSUPPORTED_MEMORY_PLATFORMS = {\"linux\", \"win32\"}  # per implementation branches\n\ndef memory_probe_supported() -> bool:\n    return platform.system().lower() in {\"linux\", \"windows\"}","typeGuard":null,"tryCatchPattern":"try:\n    total = get_system_memory_configuration()\nexcept OSError:\n    logger.warning(\"Memory detection unsupported here; using 4 GiB default\")\n    total = 4 * 1024 ** 3","preventionTips":["Probe platform support before relying on memory-based auto-config.","Mount /proc in Linux containers (meminfo lives there).","Upgrade crawl4ai — platform coverage improves across releases.","Allow explicit memory overrides in your config so detection is optional."],"tags":["platform","environment","system-info","os-error"],"backgroundTag":null,"analyzedSha":"7e801521428ee12509994d39151006f64055ebe3","analyzedAt":"2026-08-14T20:46:20.673Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}