{"record":{"id":"ccd139120b529a1c","repo":"juicedata/juicefs","slug":"failed-to-get-absolute-path-of-s-s","errorCode":null,"errorMessage":"failed to get absolute path of %s: %s","messagePattern":"failed to get absolute path of (.+?): (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/load.go","lineNumber":129,"sourceCode":"\tif key != \"\" {\n\t\tprivKey, err := object.ParsePrivateKeyFromPem([]byte(loadEncrypt(key)), []byte(os.Getenv(\"JFS_RSA_PASSPHRASE\")))\n\t\tif err != nil {\n\t\t\tif errors.Is(err, object.ErrKeyNeedPasswd) {\n\t\t\t\treturn nil, fmt.Errorf(\"%w: please set the 'JFS_RSA_PASSPHRASE' environment variable\", err)\n\t\t\t}\n\t\t\treturn nil, fmt.Errorf(\"parse private key: %s\", err)\n\t\t}\n\t\tencryptor, err := object.NewDataEncryptor(object.NewKeyEncryptor(privKey), algo)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif _, err := os.Stat(src); err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to stat %s: %s\", src, err)\n\t\t}\n\t\tvar srcAbsPath string\n\t\tsrcAbsPath, err = filepath.Abs(src)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to get absolute path of %s: %s\", src, err)\n\t\t}\n\t\tfileBlob, err := object.CreateStorage(\"file\", strings.TrimSuffix(src, filepath.Base(srcAbsPath)), \"\", \"\", \"\")\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tblob := object.NewEncrypted(fileBlob, encryptor)\n\t\tfp, ioErr = blob.Get(context.Background(), filepath.Base(srcAbsPath), 0, -1)\n\t} else {\n\t\tfp, ioErr = os.Open(src)\n\t}\n\tif ioErr != nil {\n\t\treturn nil, ioErr\n\t}\n\tif strings.HasSuffix(src, \".gz\") {\n\t\tvar err error\n\t\tr, err = gzip.NewReader(fp)\n\t\tif err != nil {\n\t\t\treturn nil, err","sourceCodeStart":111,"sourceCodeEnd":147,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/load.go#L111-L147","documentation":"After the source backup file is stat'ed, `open` calls filepath.Abs(src) to compute its absolute path, which is used to build the file:// object storage for reading the backup. filepath.Abs only fails when the current working directory cannot be determined (e.g. the cwd was deleted), so this error is rare and environmental, not caused by the path string itself.","triggerScenarios":"Calling `juicefs load`/`convert` from a shell whose current working directory has been removed (e.g. the directory was deleted or the container workdir was unmounted) so os.Getwd() inside filepath.Abs fails.","commonSituations":"Long-running shells where tmp/workspace directories were cleaned; Kubernetes/Docker exec sessions whose workdir vanished; scripts that `rm -rf` their own directory before running load.","solutions":["cd to an existing directory (e.g. `cd /`) and re-run the command","Restart the shell or container so it gets a valid working directory","Always invoke juicefs with an absolute backup path from a stable directory"],"exampleFix":"// before\ncd /tmp/workdir && rm -rf /tmp/workdir && juicefs load meta.sqlite3 backup.json\n// after\ncd / && juicefs load meta.sqlite3 /tmp/backup.json","handlingStrategy":"validation","validationCode":"if wd, err := os.Getwd(); err != nil {\n    return fmt.Errorf(\"working directory invalid: %v\", err)\n}","typeGuard":null,"tryCatchPattern":"out, err := exec.Command(\"juicefs\", \"load\", ...).CombinedOutput()\nif err != nil && strings.Contains(string(out), \"absolute path\") {\n    log.Fatalf(\"re-run from a valid cwd: %v\", err)\n}","preventionTips":["Avoid deleting the directory your shell is currently in","Run restore jobs with a fixed absolute workdir (cd / at script start)","In containers, ensure the declared WORKDIR exists"],"tags":["filesystem","path","environment"],"backgroundTag":"path-resolution-failed","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"}