junegunn/fzf · error

could not create MUTEX profile: %w

Error message

could not create MUTEX profile: %w

What it means

In a pprof build, fzf could not create the mutex-profile output file specified by --profile-mutex. The mutex fraction is set, then os.Create runs; failure wraps the OS error and stops initialization.

Source

Thrown at src/options_pprof.go:67

			runtime.GC()
			stopProfile("allocs", f)
		})
	}

	if o.BlockProfile != "" {
		runtime.SetBlockProfileRate(1)
		f, err := os.Create(o.BlockProfile)
		if err != nil {
			return fmt.Errorf("could not create BLOCK profile: %w", err)
		}
		util.AtExit(func() { stopProfile("block", f) })
	}

	if o.MutexProfile != "" {
		runtime.SetMutexProfileFraction(1)
		f, err := os.Create(o.MutexProfile)
		if err != nil {
			return fmt.Errorf("could not create MUTEX profile: %w", err)
		}
		util.AtExit(func() { stopProfile("mutex", f) })
	}

	return nil
}

View on GitHub (pinned to bd4efa277b)

Solutions

  1. Ensure the parent directory exists and is writable
  2. Prefer absolute paths under /tmp for profiling runs
  3. Validate all four --profile-* paths once in your profiling wrapper script

Example fix

# before
fzf --profile-mutex /proc/mutex.prof
# after
fzf --profile-mutex /tmp/mutex.prof
Defensive patterns

Strategy: validation

Validate before calling

d=/tmp/fzf-prof; mkdir -p "$d" && [ -w "$d" ] || exit 1
fzf --profile-mutex "$d/mutex.prof"

Prevention

When it happens

Trigger: Passing --profile-mutex pointing at an unwritable or nonexistent location.

Common situations: Identical to the other profile-output errors: bad paths, missing directories, restricted permissions in the profiling environment.

Related errors


AI-assisted analysis of junegunn/fzf@bd4efa277b (2026-08-15). Data as JSON: /api/errors/b204c748308acb53. Report an issue: GitHub.