unclecode/crawl4ai · error · OSError

Unsupported operating system

Error message

Unsupported operating system

What it means

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.

Source

Thrown at crawl4ai/utils.py:606

        class MEMORYSTATUSEX(ctypes.Structure):
            _fields_ = [
                ("dwLength", ctypes.c_ulong),
                ("dwMemoryLoad", ctypes.c_ulong),
                ("ullTotalPhys", c_ulonglong),
                ("ullAvailPhys", c_ulonglong),
                ("ullTotalPageFile", c_ulonglong),
                ("ullAvailPageFile", c_ulonglong),
                ("ullTotalVirtual", c_ulonglong),
                ("ullAvailVirtual", c_ulonglong),
                ("ullAvailExtendedVirtual", c_ulonglong),
            ]

        memoryStatus = MEMORYSTATUSEX()
        memoryStatus.dwLength = ctypes.sizeof(MEMORYSTATUSEX)
        kernel32.GlobalMemoryStatusEx(ctypes.byref(memoryStatus))
        return memoryStatus.ullTotalPhys
    else:
        raise OSError("Unsupported operating system")


def get_home_folder():
    """
    Get or create the home folder for Crawl4AI configuration and cache.

    How it works:
    1. Uses environment variables or defaults to the user's home directory.
    2. Creates `.crawl4ai` and its subdirectories (`cache`, `models`) if they don't exist.
    3. Returns the path to the home folder.

    Returns:
        str: The path to the Crawl4AI home folder.
    """

    home_folder = os.path.join(
        os.getenv(
            "CRAWL4_AI_BASE_DIRECTORY",

View on GitHub (pinned to 7e80152142)

Solutions

  1. Upgrade crawl4ai — platform coverage for memory detection has expanded across releases.
  2. On Linux containers, ensure /proc is mounted (it supplies meminfo).
  3. As a caller, wrap the call and supply a conservative default memory value when detection fails, if your code tolerates it.
  4. Report the platform to the project if a mainstream OS triggers it on the latest version.

Example fix

# before
from crawl4ai.utils import get_system_memory_configuration
total = get_system_memory_configuration()  # OSError: Unsupported operating system

# after
try:
    total = get_system_memory_configuration()
except OSError:
    total = 4 * 1024**3  # fall back to a conservative 4 GB assumption
total = get_system_memory_configuration()
Defensive patterns

Strategy: fallback

Validate before calling

import platform

SUPPORTED_MEMORY_PLATFORMS = {"linux", "win32"}  # per implementation branches

def memory_probe_supported() -> bool:
    return platform.system().lower() in {"linux", "windows"}

Try / catch

try:
    total = get_system_memory_configuration()
except OSError:
    logger.warning("Memory detection unsupported here; using 4 GiB default")
    total = 4 * 1024 ** 3

Prevention

When it happens

Trigger: 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.

Common situations: 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).

Related errors


AI-assisted analysis of unclecode/crawl4ai@7e80152142 (2026-08-14). Data as JSON: /api/errors/cf67244d640746fc. Report an issue: GitHub.