{"record":{"id":"647a8626e2f842e6","repo":"unslothai/unsloth","slug":"gguf-conversion-produced-a-symlinked-modelfile-re","errorCode":null,"errorMessage":"GGUF conversion produced a symlinked Modelfile, refusing to relocate it: {modelfile}","messagePattern":"GGUF conversion produced a symlinked Modelfile, refusing to relocate it: (.+?)","errorType":"exception","errorClass":"RuntimeError","httpStatus":null,"severity":"error","filePath":"studio/backend/core/export/export.py","lineNumber":1194,"sourceCode":"                    for src in sorted(produced):\n                        if src.is_symlink():\n                            raise RuntimeError(\n                                f\"GGUF conversion produced a symlink, refusing to relocate it: {src}\"\n                            )\n                        dest = os.path.join(abs_save_dir, src.name)\n                        shutil.move(str(src), dest)\n                        relocated_ggufs.append(dest)\n                        logger.info(f\"Relocated GGUF: {src.name} → {abs_save_dir}/\")\n                    if not relocated_ggufs:\n                        raise RuntimeError(\n                            \"GGUF conversion produced no files: no .gguf outputs for \"\n                            f\"{abs_save_dir}\"\n                        )\n\n                    if modelfiles:\n                        modelfile = sorted(modelfiles)[0]\n                        if modelfile.is_symlink():\n                            raise RuntimeError(\n                                \"GGUF conversion produced a symlinked Modelfile, \"\n                                f\"refusing to relocate it: {modelfile}\"\n                            )\n                        # Optional artifact: unsloth generates it best-effort, so a locked or\n                        # read-only destination must not fail an export whose GGUFs all landed.\n                        try:\n                            shutil.move(str(modelfile), os.path.join(abs_save_dir, \"Modelfile\"))\n                            logger.info(f\"Relocated Modelfile → {abs_save_dir}/\")\n                        except OSError as exception:\n                            logger.warning(f\"Could not relocate the Modelfile: {exception}\")\n                finally:\n                    # Preserve any GGUF that could not be relocated. The imatrix is an input,\n                    # so counting it would retain the merged checkpoint on every such export.\n                    unrelocated = []\n                    if model_tmp_path.is_dir():\n                        unrelocated = sorted(\n                            str(p)\n                            for p in model_tmp_path.rglob(\"*.gguf\")","sourceCodeStart":1176,"sourceCodeEnd":1212,"githubUrl":"https://github.com/unslothai/unsloth/blob/203007d19051dcd2ae33876786d117c99f6b0368/studio/backend/core/export/export.py#L1176-L1212","documentation":"RuntimeError raised when the Modelfile found among the conversion outputs is a symlink and is about to be relocated into the save directory. Unlike a failed Modelfile move (which is only a warning because the Modelfile is optional), a symlinked Modelfile is refused outright: moving it could follow the link and place unintended content into the user's save directory.","triggerScenarios":"The converter or a wrapper emitting Modelfile as a symlink into the temp dir; shared caches linking template Modelfiles; storage layers that materialize small files as links.","commonSituations":"Same environments as the GGUF-symlink case: containerized exports with symlinked caches, deduplicating filesystems, or converters that link boilerplate Modelfiles from templates.","solutions":["Inspect the symlink target (readlink) and replace the link with a real copy of the Modelfile in the temp dir, then re-export.","Disable whatever layer is creating links in the export temp tree (cache dedup options, mount style).","Note the GGUFs may have already been relocated successfully; only the Modelfile step aborts — fixing the link and re-running completes it."],"exampleFix":"# diagnose\nreadlink -f /tmp/.../Modelfile\ncp --remove-destination \"$(readlink -f /tmp/.../Modelfile)\" /tmp/.../Modelfile\n# then re-run the export","handlingStrategy":"validation","validationCode":"mf = next(Path(model_tmp).rglob('Modelfile'), None)\nif mf is not None and mf.is_symlink():\n    replace_link_with_copy(mf)","typeGuard":null,"tryCatchPattern":"try:\n    export()\nexcept RuntimeError as e:\n    if 'symlinked Modelfile' in str(e):\n        replace_link_with_copy(modelfile_path); export()  # GGUFs may already be relocated","preventionTips":["Treat any symlink in converter output as a defect and materialize real files.","Keep export temp trees on plain directories, not linked caches."],"tags":["export","gguf","modelfile","symlink","studio"],"backgroundTag":null,"analyzedSha":"203007d19051dcd2ae33876786d117c99f6b0368","analyzedAt":"2026-08-15T02:48:39.846Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}