{"record":{"id":"7054a0ea22acaaf6","repo":"unslothai/unsloth","slug":"video-generation-was-cancelled","errorCode":null,"errorMessage":"Video generation was cancelled.","messagePattern":"Video generation was cancelled\\.","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"info","filePath":"studio/backend/core/inference/video.py","lineNumber":1636,"sourceCode":"        # pulls from both, and neither is repo_id or base_repo. loaded_repo_ids() is the committed\n        # twin; expected_bytes stays below, where the sizes are known.\n        # begin_load publishes the same claim with _loading, covering the gap before this thread is\n        # scheduled. This one is for load_pipeline, which never goes through begin_load.\n        with self._lock:\n            if self._load_token == token and self._loading is not None:\n                self._loading.base_repo = fam.base_repo\n                self._loading.asset_repos = (H3_GGUF_REPO, H3_COMPONENT_REPO)\n\n        # BEFORE the download, not after it. The H3-gated ensure, not the plain one: a build that\n        # predates H3 runs fine and so clears the version() gate below, then aborts on the first\n        # generation. That is the whole reason this gate exists, and running it after the four-file\n        # bundle had already been fetched meant the user still paid tens of GB to be told no.\n        #\n        # Cancel first, though: the ensure below may download and extract the sd-cli prebuilt, and\n        # it takes no cancel_event, so a load cancelled before this thread got going would pay for\n        # an install nobody is waiting for. The download loop used to be the first check.\n        if cancel_event.is_set():\n            raise RuntimeError(VIDEO_CANCELLED_MSG)\n        target = self._device_target(gpu_ordinal)\n        allow_install = _install_allowed()\n        binary = ensure_h3_sd_cpp_binary(\n            allow_install = allow_install,\n            accelerator = _install_accelerator_for(target.backend),\n        )\n        native_device = target.device\n        # What the accelerator decision below was made on, or None when it was never asked (a CPU\n        # or MPS target never consults it). Re-checked under the reader claim, so a replacement\n        # that arrives mid-load cannot silently change the answer this device choice rests on.\n        listed_accelerator: Optional[bool] = None\n        if target.backend not in (\"cpu\", \"mps\"):\n            # Under the claim, like the recheck. This probe SPAWNS the managed sd-cli, so leaving\n            # it unclaimed lets an install started by another in-process load extract over the\n            # executing binary: on Windows that fails on the locked file, on Linux it can leave\n            # the replacement half-written. The later claimed recheck cannot undo damage this\n            # first probe already allowed.\n            from .sd_cpp_backend import _tree_reader as _claim_tree","sourceCodeStart":1618,"sourceCodeEnd":1654,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/inference/video.py#L1618-L1654","documentation":"Cancel notification raised at the first checkpoint of the H3 native (stable-diffusion.cpp) load worker, before the multi-GB download: if the load's cancel_event is already set when the worker starts (or reaches this point), it aborts immediately with the shared VIDEO_CANCELLED_MSG. This ordering exists so a cancel issued during install/setup does not still pay for the model download.","triggerScenarios":"begin_load for a MiniMax-H3 native GGUF load returns, then cancel/unload is called before or while the worker thread is starting — the worker sees cancel_event.is_set() at this first check and raises RuntimeError(VIDEO_CANCELLED_MSG).","commonSituations":"User clicks Load then immediately Cancel/Unload; an orchestration layer rolling back a load; switching models in rapid succession.","solutions":["No fix needed if the cancel was intended — this is the expected cancellation signal.","If the cancel was accidental, simply start the load again.","Client code should treat this message as a normal cancellation outcome, not an error to alert on."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try:\n    run_h3_load(...)\nexcept RuntimeError as e:\n    if str(e) == VIDEO_CANCELLED_MSG:\n        return Cancelled()  # expected outcome of cancel(); not an error\n    raise","preventionTips":["Do not fire cancel/unload unless you truly want the load aborted.","Map VIDEO_CANCELLED_MSG to a distinct 'cancelled' state in clients.","When switching models, cancel once and wait for the load thread to exit before starting the next."],"tags":["video","cancellation","minimax-h3","runtime"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}