{"record":{"id":"e7ae920617cc4937","repo":"multica-ai/multica","slug":"mklink-j-s-s-s-w","errorCode":null,"errorMessage":"mklink /J %s %s: %s: %w","messagePattern":"mklink /J (.+?) (.+?): (.+?): %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/internal/daemon/execenv/codex_home_link_windows.go","lineNumber":20,"sourceCode":"\npackage execenv\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"os/exec\"\n)\n\n// createDirLink tries os.Symlink first (requires Developer Mode or admin on\n// Windows). If that fails, it falls back to a directory junction (mklink /J)\n// which works without elevated privileges.\nfunc createDirLink(src, dst string) error {\n\tif err := os.Symlink(src, dst); err == nil {\n\t\treturn nil\n\t}\n\tout, err := exec.Command(\"cmd\", \"/c\", \"mklink\", \"/J\", dst, src).CombinedOutput()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"mklink /J %s %s: %s: %w\", dst, src, out, err)\n\t}\n\treturn nil\n}\n\n// createFileLink tries os.Symlink first. If that fails, it falls back to\n// copying the file so the content is still available.\nfunc createFileLink(src, dst string) error {\n\tif err := os.Symlink(src, dst); err == nil {\n\t\treturn nil\n\t}\n\treturn copyFile(src, dst)\n}\n","sourceCodeStart":2,"sourceCodeEnd":33,"githubUrl":"https://github.com/multica-ai/multica/blob/2c0912b6ec764b373d44eeea1e80f0d9f11ab417/server/internal/daemon/execenv/codex_home_link_windows.go#L2-L33","documentation":"Windows-only createDirLink: os.Symlink failed (no Developer Mode / admin), and the cmd mklink /J junction fallback also failed. The error includes mklink's combined output, so the reason (existing destination, invalid path, privilege issue) is in the message text.","triggerScenarios":"Exposing the shared plugin cache into a task home where the junction destination already exists; path with characters cmd misparses; mklink unavailable on the Windows edition.","commonSituations":"Reused task home already containing plugins\\cache; leftover junction from a crashed run; Windows Server Core without standard cmd tooling.","solutions":["Read the embedded mklink output — 'Cannot create a file when that file already exists' means the dst must be removed first","Delete the stale junction/directory at dst and retry","Enable Windows Developer Mode so os.Symlink succeeds directly"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"if _, err := os.Lstat(dst); err == nil {\n\treturn fmt.Errorf(\"link destination already exists: %s\", dst)\n}","typeGuard":null,"tryCatchPattern":"if err := createDirLink(src, dst); err != nil {\n\tif strings.Contains(err.Error(), \"Already exists\") || strings.Contains(err.Error(), \"already exists\") {\n\t\t_ = os.Remove(dst)\n\t\terr = createDirLink(src, dst)\n\t}\n}","preventionTips":["Remove stale junctions before exposing the shared plugin cache","Enable Windows Developer Mode so os.Symlink is tried successfully first","Read the embedded mklink output — it states the exact reason"],"tags":["windows","filesystem","junction","codex-home"],"backgroundTag":null,"analyzedSha":"2c0912b6ec764b373d44eeea1e80f0d9f11ab417","analyzedAt":"2026-08-15T13:25:18.241Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}