{"record":{"id":"3cb86b3c26336af6","repo":"unslothai/unsloth","slug":"resume-checkpoint-uses-a-path-from-a-different-ope","errorCode":null,"errorMessage":"Resume checkpoint uses a path from a different operating system.","messagePattern":"Resume checkpoint uses a path from a different operating system\\.","errorType":"validation","errorClass":"ValueError","httpStatus":null,"severity":"error","filePath":"studio/backend/core/training/resume.py","lineNumber":217,"sourceCode":"        return None\n    if is_resume_checkpoint_valid(path, expected_step):\n        return str(path)\n\n    checkpoints = sorted(path.glob(\"checkpoint-*\"), key = _checkpoint_step, reverse = True)\n    return next(\n        (\n            str(checkpoint)\n            for checkpoint in checkpoints\n            if _checkpoint_step(checkpoint) >= 0\n            and is_resume_checkpoint_valid(checkpoint, expected_step)\n        ),\n        None,\n    )\n\n\ndef normalize_resume_output_dir(path_value: str) -> str:\n    if _is_foreign_absolute_path(path_value):\n        raise ValueError(\"Resume checkpoint uses a path from a different operating system.\")\n    try:\n        path = resolve_output_dir(path_value)\n        path.resolve(strict = True)\n    except (OSError, RuntimeError) as error:\n        raise ValueError(\"Resume checkpoint path could not be resolved.\") from error\n    if not _is_under_outputs(path):\n        raise ValueError(\"Resume checkpoint must be inside Unsloth outputs.\")\n    return str(path)\n\n\ndef training_run_config(run: dict) -> dict:\n    raw_config = run.get(\"config_json\")\n    if isinstance(raw_config, dict):\n        return raw_config\n    if not isinstance(raw_config, str) or not raw_config.strip():\n        return {}\n    try:\n        parsed = json.loads(raw_config)","sourceCodeStart":199,"sourceCodeEnd":235,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/training/resume.py#L199-L235","documentation":"Raised by normalize_resume_output_dir when the supplied resume path is absolute under a foreign OS path flavor — e.g. 'C:\\models\\out' on Linux or '/data/out' on Windows. The helper _is_foreign_absolute_path (resume.py:15) detects this via PureWindowsPath/PurePosixPath, because Path() on the host OS cannot treat it as absolute and later resolution would silently produce a wrong relative path. The guard runs before resolve_output_dir so training never resumes from a bogus location.","triggerScenarios":"Calling normalize_resume_output_dir('C:\\\\Users\\\\me\\\\outputs\\\\run1') on a Linux server, or normalize_resume_output_dir('/home/me/outputs/run1') on Windows; typically when a run config or UI state was copied between machines with different operating systems.","commonSituations":"Training started on Windows and the checkpoint path was saved into a config/DB, then the same config is reused on a Linux training box (or vice versa); hand-edited YAML/JSON resume fields with backslashes; CI runners on a different OS than the developer workstation.","solutions":["Point resume at a checkpoint path that is absolute for the current OS, or use a relative path under the Unsloth outputs root.","If the checkpoint lives on another machine, copy it under the local outputs directory first and resume from the local copy.","Re-run training from scratch if the foreign checkpoint is not available locally."],"exampleFix":"// before\nnormalize_resume_output_dir(\"C:\\\\unsloth\\\\outputs\\\\checkpoint-100\")  # on Linux\n// after\nnormalize_resume_output_dir(\"outputs/my-run/checkpoint-100\")  # relative, resolves under local outputs root","handlingStrategy":"validation","validationCode":"from pathlib import PureWindowsPath, PurePosixPath, Path\n\ndef is_native_or_relative(path_value: str) -> bool:\n    native = Path(path_value)\n    return native.is_absolute() or not (\n        PureWindowsPath(path_value).is_absolute() or PurePosixPath(path_value).is_absolute()\n    )\n\nassert is_native_or_relative(resume_path), \"resume path is for another OS\"","typeGuard":"def is_safe_resume_path(path_value: str) -> bool:\n    return isinstance(path_value, str) and is_native_or_relative(path_value)","tryCatchPattern":"try:\n    normalized = normalize_resume_output_dir(path_value)\nexcept ValueError as e:\n    if \"different operating system\" in str(e):\n        # re-point resume at a native path under outputs\n        ...","preventionTips":["Store resume paths relative to the outputs root so configs port across OSes.","Never copy run configs containing absolute paths between Windows and Linux machines.","Normalize paths at the point of entry (UI/DB) instead of deep in training code."],"tags":["path","cross-platform","training-resume","validation"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}