juicedata/juicefs · error

abs of %s: %s

Error message

abs of %s: %s

What it means

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.

Source

Thrown at cmd/clone.go:70

				Name:    "preserve",
				Aliases: []string{"p"},
				Usage:   "preserve the uid, gid, and mode of the file. (This is forced on Windows)",
			},
			&cli.IntFlag{
				Name:  "threads",
				Value: meta.CLONE_DEFAULT_CONCURRENCY,
				Usage: "number of concurrent workers for cloning directories",
			},
		},
	}
}

func clone(ctx *cli.Context) error {
	setup(ctx, 2)
	srcPath := ctx.Args().Get(0)
	srcAbsPath, err := filepath.Abs(srcPath)
	if err != nil {
		return fmt.Errorf("abs of %s: %s", srcPath, err)
	}
	srcIno, err := utils.GetFileInode(srcPath)
	if err != nil {
		return fmt.Errorf("lookup inode for %s: %s", srcPath, err)
	}
	srcParentIno, err := utils.GetFileInode(filepath.Dir(srcAbsPath))
	if err != nil {
		return fmt.Errorf("lookup inode for %s: %s", filepath.Dir(srcAbsPath), err)
	}
	dst := ctx.Args().Get(1)
	if strings.HasSuffix(dst, string(filepath.Separator)) {
		dst = filepath.Join(dst, filepath.Base(srcPath))
	}
	if _, err := os.Stat(dst); err == nil {
		return fmt.Errorf("%s already exists", dst)
	} else if !os.IsNotExist(err) {
		return fmt.Errorf("stat %s: %s", dst, err)
	}

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. cd to a valid, existing directory before running the clone command.
  2. Pass an absolute source path so filepath.Abs doesn't need the working directory.
  3. Re-mount or recreate the working directory if the shell is sitting in a deleted path.

Example fix

# before (cwd deleted)
juicefs clone meta.sqlite3:0 relative/src /dst
# after
cd /root
juicefs clone meta.sqlite3:0 /mnt/jfs/relative/src /dst
Defensive patterns

Strategy: validation

Validate before calling

if _, err := os.Getwd(); err != nil {
	return fmt.Errorf("current working directory is invalid: %w", err)
}

Try / catch

err := clone(ctx)
if strings.HasPrefix(err.Error(), "abs of ") {
	log.Println("cwd invalid or path unresolvable; retry from a valid directory")
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Understand the failure class

Background: "Must be a positive integer", "Invalid value", "Unsupported": the invalid-argument-value error family, when a library rejects the value you pass — this error's family across 35 libraries.

Related errors


AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06). Data as JSON: /api/errors/cfbca98b6c82b1eb. Report an issue: GitHub.