juicedata/juicefs · error
failed to get absolute path: %v
Error message
failed to get absolute path: %v
What it means
`juicefs debug` converts the mount point argument to an absolute path with `filepath.Abs` before constructing the output directory name. This error is thrown if `filepath.Abs` fails, which is rare — it can only fail when resolving the path requires the current working directory and `os.Getwd` fails.
Source
Thrown at cmd/debug.go:526
var inode uint64
if err := utils.WithTimeout(context.TODO(), func(context.Context) error {
var err error
if inode, err = utils.GetFileInode(mp); err != nil {
return fmt.Errorf("failed to lookup inode for %s: %s", mp, err)
}
return nil
}, 3*time.Second); err != nil {
logger.Warn(err.Error())
logger.Warnf("assuming the mount point is JuiceFS mount point")
} else {
if inode != uint64(meta.RootInode) {
return fmt.Errorf("path %s is not a mount point", mp)
}
}
amp, err := filepath.Abs(mp)
if err != nil {
return fmt.Errorf("failed to get absolute path: %v", err)
}
timestamp := time.Now().Format("20060102150405")
prefix := strings.Trim(strings.Join(strings.Split(amp, "/"), "-"), "-")
if runtime.GOOS == "windows" {
prefix = strings.ReplaceAll(prefix, ":", "")
}
outDir := ctx.String("out-dir")
currDir := filepath.Join(outDir, fmt.Sprintf("%s-%s", prefix, timestamp))
if err := os.MkdirAll(currDir, os.ModePerm); err != nil {
return fmt.Errorf("failed to create current out dir %s: %v", currDir, err)
}
if err := collectSysInfo(ctx, currDir); err != nil {
logger.Errorf("Failed to collect system info: %v", err)
}
uid, pid, cmd, err := getCmdMount(amp)
logger.Infof("mount point:%q pid:%s uid:%s", amp, pid, uid)View on GitHub (pinned to c9a67b23e8)
Solutions
- `cd` to a valid directory (e.g. `/tmp`) before running `juicefs debug`.
- Pass an absolute mount point path so `filepath.Abs` doesn't need the cwd.
- Verify the current working directory still exists (`pwd`).
Example fix
// before (cwd deleted) $ juicefs debug jfs // after $ cd /tmp && juicefs debug /jfs
Defensive patterns
Strategy: validation
Validate before calling
if cwd, err := os.Getwd(); err != nil {
return fmt.Errorf("current working directory invalid: %w", err)
}
// or pass an absolute path
if !filepath.IsAbs(mp) { mp, _ = filepath.Abs(mp) } Type guard
null
Try / catch
null
Prevention
- Don't run the CLI from a deleted directory
- Prefer absolute mount point paths
- `cd /` if `pwd` fails before running debug
When it happens
Trigger: Running `juicefs debug <relative-path>` while the process's current working directory has been deleted or is otherwise unresolvable, causing `os.Getwd` inside `filepath.Abs` to fail.
Common situations: Shell sitting in a removed directory; running the binary after the cwd was unmounted or deleted.
Understand the failure class
Background: "Invalid ... format", "must be in format X", "does not look like a ..." — invalid argument format errors across CLI tools and libraries — this error's family across 17 libraries.
Related errors
- Unsupported ByteMultiple " + sMultiple
- wrong type
- random, backward, skip are only valid under read
- random, backward, skip are mutually exclusive
- No kerberos credential was found! Parameter "--keytab" and "
AI-assisted analysis of juicedata/juicefs@c9a67b23e8 (2026-09-06).
Data as JSON: /api/errors/c825493e8a913fb0.
Report an issue: GitHub.