{"record":{"id":"928100d837877b07","repo":"juicedata/juicefs","slug":"failed-to-get-volume-config-s-v","errorCode":null,"errorMessage":"failed to get volume config %s: %v","messagePattern":"failed to get volume config (.+?): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/debug.go","lineNumber":478,"sourceCode":"\t\treturn fmt.Errorf(\"failed to write system info file %s: %v\", sysPath, err)\n\t}\n\n\tfmt.Printf(\"\\n%s\\n\", result)\n\treturn nil\n}\n\nfunc collectSpecialFile(ctx *cli.Context, amp string, currDir string, requireRootPrivileges bool, wg *sync.WaitGroup) error {\n\tprefixed := true\n\tconfigName := \".jfs.config\"\n\t_ = utils.WithTimeout(context.TODO(), func(context.Context) error {\n\t\tif !utils.Exists(filepath.Join(amp, configName)) {\n\t\t\tconfigName = \".config\"\n\t\t\tprefixed = false\n\t\t}\n\t\treturn nil\n\t}, 3*time.Second)\n\tif err := copyFile(filepath.Join(amp, configName), filepath.Join(currDir, \"config.txt\"), requireRootPrivileges); err != nil {\n\t\treturn fmt.Errorf(\"failed to get volume config %s: %v\", configName, err)\n\t}\n\n\tstatsName := \".jfs.stats\"\n\tif !prefixed {\n\t\tstatsName = statsName[4:]\n\t}\n\tstats := ctx.Uint64(\"stats-sec\")\n\twg.Add(1)\n\tgo func() {\n\t\tdefer wg.Done()\n\t\tsrcPath := filepath.Join(amp, statsName)\n\t\tdestPath := filepath.Join(currDir, \"stats.txt\")\n\t\tif err := copyFile(srcPath, destPath, requireRootPrivileges); err != nil {\n\t\t\tlogger.Errorf(\"Failed to get volume config %s: %v\", statsName, err)\n\t\t}\n\n\t\tlogger.Infof(\"Stats metrics are being sampled, sampling duration: %ds\", stats)\n\t\ttime.Sleep(time.Second * time.Duration(stats))","sourceCodeStart":460,"sourceCodeEnd":496,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/debug.go#L460-L496","documentation":"The `juicefs debug` command copies the volume's config file (`.config` or a prefixed variant) from the mount point directory into the output directory. This error is thrown by `collectSpecialFile` when `copyFile` fails, wrapping the underlying copy error (e.g. permission problems or a missing config file) with the config file name.","triggerScenarios":"Running `juicefs debug <mp>` where `copyFile(<mp>/.config, <out>/config.txt)` fails because the config file does not exist, the user lacks read permission, or the copy needs root (requireRootPrivileges) and the user is not root.","commonSituations":"Debugging a mount point owned by root while running as a normal user; the `.config` file was deleted from the mount point; the mount point is not actually a JuiceFS mount so `.config` is absent.","solutions":["Re-run `juicefs debug` with sudo/root so the config file can be read (the tool itself hints when root is needed).","Verify the `.config` file exists at the mount point: `ls -la <mp>/.config`; if missing, the directory is not a JuiceFS mount — check the mount point.","Check file permissions on `.config` and the output directory; ensure the output dir is writable.","Inspect the wrapped `%v` error in the message to identify the exact copy failure (read vs write side)."],"exampleFix":"// before (run as normal user)\n$ juicefs debug /jfs\n// after (config file requires root to read)\n$ sudo juicefs debug /jfs","handlingStrategy":"fallback","validationCode":"if _, err := os.Stat(filepath.Join(mp, \".config\")); err != nil { fmt.Println(\"not a JuiceFS mount point or config unreadable:\", err) }\nif os.Getuid() != 0 { fmt.Println(\"config may require root; consider sudo juicefs debug\") }","typeGuard":"func hasVolumeConfig(mp string) bool { _, err := os.Stat(filepath.Join(mp, \".config\")); return err == nil }","tryCatchPattern":"err := runDebug(mp)\nvar perr *fs.PathError\nif errors.As(err, &perr) && errors.Is(perr.Err, os.ErrPermission) {\n    // rerun with elevated privileges\n}\nreturn err","preventionTips":["Check that <mp>/.config exists before invoking debug","Run debug with sudo when the mount was created by root","Keep the output directory writable by the invoking user"],"tags":["cli","filesystem","permissions"],"backgroundTag":"file-read-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"}