juicedata/juicefs · error

failed to create out directory: %v

Error message

failed to create out directory: %v

What it means

Returned by collectPprof when the output directory for pprof data (under the juicefs debug collection dir) cannot be created. It wraps the mkdir error, usually permissions or a path conflict on the local filesystem.

Source

Thrown at cmd/debug.go:384

	trace := ctx.Uint64("trace-sec")
	profile := ctx.Uint64("profile-sec")
	metrics := map[string]metricItem{
		"allocs":       {name: "allocs.pb.gz", url: baseUrl + "allocs"},
		"blocks":       {name: "block.pb.gz", url: baseUrl + "block"},
		"cmdline":      {name: "cmdline.txt", url: baseUrl + "cmdline"},
		"goroutine":    {name: "goroutine.pb.gz", url: baseUrl + "goroutine"},
		"stack":        {name: "goroutine.stack.txt", url: baseUrl + "goroutine?debug=1"},
		"stack-detail": {name: "goroutine.stack.detail.txt", url: baseUrl + "goroutine?debug=2"},
		"heap":         {name: "heap.pb.gz", url: baseUrl + "heap"},
		"mutex":        {name: "mutex.pb.gz", url: baseUrl + "mutex"},
		"threadcreate": {name: "threadcreate.pb.gz", url: baseUrl + "threadcreate"},
		"trace":        {name: fmt.Sprintf("trace.%ds.pb.gz", trace), url: fmt.Sprintf("%strace?seconds=%d", baseUrl, trace)},
		"profile":      {name: fmt.Sprintf("profile.%ds.pb.gz", profile), url: fmt.Sprintf("%sprofile?seconds=%d", baseUrl, profile)},
	}

	pprofOutDir := filepath.Join(currDir, "pprof")
	if err := os.Mkdir(pprofOutDir, os.ModePerm); err != nil {
		return fmt.Errorf("failed to create out directory: %v", err)
	}

	for name, metric := range metrics {
		wg.Add(1)
		go func(name string, metric metricItem) {
			timeout := 3 * time.Second
			defer wg.Done()
			if name == "profile" {
				logger.Infof("Profile metrics are being sampled, sampling duration: %ds", profile)
				timeout = time.Duration(profile+5) * time.Second
			}
			if name == "trace" {
				logger.Infof("Trace metrics are being sampled, sampling duration: %ds", trace)
				timeout = time.Duration(trace+5) * time.Second
			}
			if err := reqAndSaveMetric(name, metric, pprofOutDir, timeout); err != nil {
				logger.Errorf("Failed to get and save metric %s: %v", name, err)
			}

View on GitHub (pinned to c9a67b23e8)

Solutions

  1. Choose a writable --out-dir for `juicefs debug` and check permissions
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at cmd/debug.go:384 when the library encounters an invalid state.

Common situations: See trigger scenarios.


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