{"record":{"id":"c825493e8a913fb0","repo":"juicedata/juicefs","slug":"failed-to-get-absolute-path-v","errorCode":null,"errorMessage":"failed to get absolute path: %v","messagePattern":"failed to get absolute path: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/debug.go","lineNumber":526,"sourceCode":"\tvar inode uint64\n\tif err := utils.WithTimeout(context.TODO(), func(context.Context) error {\n\t\tvar err error\n\t\tif inode, err = utils.GetFileInode(mp); err != nil {\n\t\t\treturn fmt.Errorf(\"failed to lookup inode for %s: %s\", mp, err)\n\t\t}\n\t\treturn nil\n\t}, 3*time.Second); err != nil {\n\t\tlogger.Warn(err.Error())\n\t\tlogger.Warnf(\"assuming the mount point is JuiceFS mount point\")\n\t} else {\n\t\tif inode != uint64(meta.RootInode) {\n\t\t\treturn fmt.Errorf(\"path %s is not a mount point\", mp)\n\t\t}\n\t}\n\n\tamp, err := filepath.Abs(mp)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get absolute path: %v\", err)\n\t}\n\ttimestamp := time.Now().Format(\"20060102150405\")\n\tprefix := strings.Trim(strings.Join(strings.Split(amp, \"/\"), \"-\"), \"-\")\n\tif runtime.GOOS == \"windows\" {\n\t\tprefix = strings.ReplaceAll(prefix, \":\", \"\")\n\t}\n\toutDir := ctx.String(\"out-dir\")\n\tcurrDir := filepath.Join(outDir, fmt.Sprintf(\"%s-%s\", prefix, timestamp))\n\tif err := os.MkdirAll(currDir, os.ModePerm); err != nil {\n\t\treturn fmt.Errorf(\"failed to create current out dir %s: %v\", currDir, err)\n\t}\n\n\tif err := collectSysInfo(ctx, currDir); err != nil {\n\t\tlogger.Errorf(\"Failed to collect system info: %v\", err)\n\t}\n\n\tuid, pid, cmd, err := getCmdMount(amp)\n\tlogger.Infof(\"mount point:%q pid:%s uid:%s\", amp, pid, uid)","sourceCodeStart":508,"sourceCodeEnd":544,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/debug.go#L508-L544","documentation":"`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.","triggerScenarios":"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.","commonSituations":"Shell sitting in a removed directory; running the binary after the cwd was unmounted or deleted.","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`)."],"exampleFix":"// before (cwd deleted)\n$ juicefs debug jfs\n// after\n$ cd /tmp && juicefs debug /jfs","handlingStrategy":"validation","validationCode":"if cwd, err := os.Getwd(); err != nil {\n  return fmt.Errorf(\"current working directory invalid: %w\", err)\n}\n// or pass an absolute path\nif !filepath.IsAbs(mp) { mp, _ = filepath.Abs(mp) }","typeGuard":"null","tryCatchPattern":"null","preventionTips":["Don't run the CLI from a deleted directory","Prefer absolute mount point paths","`cd /` if `pwd` fails before running debug"],"tags":["cli","paths"],"backgroundTag":"invalid-argument-format","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"}