{"record":{"id":"cfbca98b6c82b1eb","repo":"juicedata/juicefs","slug":"abs-of-s-s","errorCode":null,"errorMessage":"abs of %s: %s","messagePattern":"abs of (.+?): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/clone.go","lineNumber":70,"sourceCode":"\t\t\t\tName:    \"preserve\",\n\t\t\t\tAliases: []string{\"p\"},\n\t\t\t\tUsage:   \"preserve the uid, gid, and mode of the file. (This is forced on Windows)\",\n\t\t\t},\n\t\t\t&cli.IntFlag{\n\t\t\t\tName:  \"threads\",\n\t\t\t\tValue: meta.CLONE_DEFAULT_CONCURRENCY,\n\t\t\t\tUsage: \"number of concurrent workers for cloning directories\",\n\t\t\t},\n\t\t},\n\t}\n}\n\nfunc clone(ctx *cli.Context) error {\n\tsetup(ctx, 2)\n\tsrcPath := ctx.Args().Get(0)\n\tsrcAbsPath, err := filepath.Abs(srcPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"abs of %s: %s\", srcPath, err)\n\t}\n\tsrcIno, err := utils.GetFileInode(srcPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"lookup inode for %s: %s\", srcPath, err)\n\t}\n\tsrcParentIno, err := utils.GetFileInode(filepath.Dir(srcAbsPath))\n\tif err != nil {\n\t\treturn fmt.Errorf(\"lookup inode for %s: %s\", filepath.Dir(srcAbsPath), err)\n\t}\n\tdst := ctx.Args().Get(1)\n\tif strings.HasSuffix(dst, string(filepath.Separator)) {\n\t\tdst = filepath.Join(dst, filepath.Base(srcPath))\n\t}\n\tif _, err := os.Stat(dst); err == nil {\n\t\treturn fmt.Errorf(\"%s already exists\", dst)\n\t} else if !os.IsNotExist(err) {\n\t\treturn fmt.Errorf(\"stat %s: %s\", dst, err)\n\t}","sourceCodeStart":52,"sourceCodeEnd":88,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/clone.go#L52-L88","documentation":"The `juicefs clone` command first converts the source path to an absolute path with filepath.Abs. It fails with \"abs of %s: %s\" if filepath.Abs returns an error, which happens almost exclusively when determining the working directory (os.Getwd) fails — e.g. the current directory was deleted or is inaccessible.","triggerScenarios":"Running clone while the shell's current working directory has been removed (stale cwd), or when getcwd is blocked by permissions; a relative source path then forces Abs to call os.Getwd, which errors.","commonSituations":"Scripts cd into a temp directory that is later deleted; running from a deleted mount point; restricted environments where the process lacks search permission on its cwd.","solutions":["cd to a valid, existing directory before running the clone command.","Pass an absolute source path so filepath.Abs doesn't need the working directory.","Re-mount or recreate the working directory if the shell is sitting in a deleted path."],"exampleFix":"# before (cwd deleted)\njuicefs clone meta.sqlite3:0 relative/src /dst\n# after\ncd /root\njuicefs clone meta.sqlite3:0 /mnt/jfs/relative/src /dst","handlingStrategy":"validation","validationCode":"if _, err := os.Getwd(); err != nil {\n\treturn fmt.Errorf(\"current working directory is invalid: %w\", err)\n}","typeGuard":null,"tryCatchPattern":"err := clone(ctx)\nif strings.HasPrefix(err.Error(), \"abs of \") {\n\tlog.Println(\"cwd invalid or path unresolvable; retry from a valid directory\")\n}","preventionTips":["Avoid executing clone from directories that scripts may delete afterwards","Prefer absolute source paths in automation so os.Getwd is never needed","Re-cd to a stable directory at the start of long-running scripts"],"tags":["cli","filesystem","path"],"backgroundTag":"invalid-argument-value","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}