{"record":{"id":"516a5be9e98816b6","repo":"juicedata/juicefs","slug":"lookup-inode-for-s-s","errorCode":null,"errorMessage":"lookup inode for %s: %s","messagePattern":"lookup inode for (.+?): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/clone.go","lineNumber":74,"sourceCode":"\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}\n\tdstAbsPath, err := filepath.Abs(dst)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"abs of %s: %s\", dst, err)\n\t}","sourceCodeStart":56,"sourceCodeEnd":92,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/clone.go#L56-L92","documentation":"After resolving the absolute path, clone reads the source file's inode with utils.GetFileInode(srcPath). \"lookup inode for %s: %s\" means that call failed — typically the source path does not exist or is not a regular file/directory on which the ioctl-based inode lookup works.","triggerScenarios":"Calling `juicefs clone <src> <dst>` where src doesn't exist, is a dangling symlink, resides outside a JuiceFS mount (GetFileInode uses FS_IOC_FIEMAP/inode ioctls unsupported by other filesystems), or the path lacks permission to be stat'd.","commonSituations":"Typo'd source path, cloning a file from a non-JuiceFS filesystem (ext4/NFS won't report the expected inode via the ioctl), cloning after the source was deleted by another process, or permission issues on the path.","solutions":["Verify the source path exists (ls) and is spelled correctly.","Ensure the source lives on a JuiceFS mount — clone only works for JuiceFS files.","Check read/stat permissions on the source path.","Re-check the source wasn't concurrently removed (especially in scripts)."],"exampleFix":"# before\njuicefs clone meta.sqlite3:0 /mnt/jfs/missing-file /dst\n# after\nls /mnt/jfs/missing-file   # confirm it exists first\njuicefs clone meta.sqlite3:0 /mnt/jfs/real-file /dst","handlingStrategy":"validation","validationCode":"func srcExists(p string) bool {\n\tfi, err := os.Stat(p)\n\treturn err == nil && (fi.Mode().IsRegular() || fi.IsDir())\n}\n// check srcExists(src) before running clone","typeGuard":null,"tryCatchPattern":"if err := clone(ctx); err != nil && strings.HasPrefix(err.Error(), \"lookup inode for\") {\n\tlog.Printf(\"source %s not clonable (missing or not on JuiceFS): %v\", ctx.Args().Get(0), err)\n}","preventionTips":["Confirm the source exists and is inside the JuiceFS mount before cloning","Remember clone relies on inode ioctls — other filesystems will fail the lookup","In pipelines, re-stat the source right before cloning to catch concurrent deletion"],"tags":["cli","filesystem","inode","path"],"backgroundTag":"file-not-found","analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}