junegunn/fzf · error
failed to start pprof profiles: %s
Error message
failed to start pprof profiles: %s
What it means
fzf failed to start the pprof CPU/blockprofileng profiles requested via --profile-cpu, --profile-mem, or --profile-block. opts.initProfiling() returned an error (typically a file creation/open failure for a profile path), and options.go:3890 wraps it as 'failed to start pprof profiles: <cause>'.
Source
Thrown at src/options.go:3890
}
opts.MinHeight += borderLines(borderShape) + opts.HeaderLines
}
if len(opts.Preview.command) > 0 && (opts.Preview.position == posUp || opts.Preview.position == posDown) && opts.Preview.Visible() && opts.Preview.position == posUp {
borderShape := opts.Preview.border
if opts.Preview.border == tui.BorderLine {
borderShape = tui.BorderTop
}
opts.MinHeight += borderLines(borderShape) + 10
}
for _, s := range []sizeSpec{opts.Margin[0], opts.Margin[2], opts.Padding[0], opts.Padding[2]} {
if !s.percent {
opts.MinHeight += int(s.size)
}
}
}
if err := opts.initProfiling(); err != nil {
return errors.New("failed to start pprof profiles: " + err.Error())
}
algo.Init(opts.Scheme)
return nil
}
func parseShellWords(str string) ([]string, error) {
parser := shellwords.NewParser()
parser.ParseComment = true
return parser.Parse(str)
}
// ParseOptions parses command-line options
func ParseOptions(useDefaults bool, args []string) (*Options, error) {
opts := defaultOptions()
index := 0
View on GitHub (pinned to bd4efa277b)
Solutions
- Check the wrapped cause: 'no such file or directory' means the parent directory must be created; 'permission denied' means fixing ownership/permissions
- Use an absolute path in a writable directory, e.g. --profile-cpu=/tmp/fzf.pprof
- Ensure the path names a file (not a directory) and the disk is not full
- Remove stale root-owned profile files from earlier sudo runs
Example fix
# before fzf --profile-cpu=/var/log/fzf/cpu.pprof # after mkdir -p /tmp/fzf-prof && fzf --profile-cpu=/tmp/fzf-prof/cpu.pprof
Defensive patterns
Strategy: try-catch
Validate before calling
# Shell: ensure the profile directory is writable before launch
prof_dir=/tmp/fzf-prof
mkdir -p "$prof_dir" && [ -w "$prof_dir" ] || { echo "cannot write $prof_dir" >&2; exit 1; }
exec fzf --profile-cpu="$prof_dir/cpu.pprof" Try / catch
In Go, capture exec.ExitError stderr; if it starts with 'failed to start pprof profiles:', surface the wrapped cause (usually 'no such file or directory' or 'permission denied') and fail fast — retrying will not help until the path is fixed.
Prevention
- Use absolute profile paths under a directory you create first (/tmp is safe)
- Check directory writability and disk space before starting a profiled run
- Never reuse root-owned files left by sudo runs; delete stale profile files
- Profiles are debug-only flags — keep them out of production wrappers
When it happens
Trigger: Passing --profile-cpu (or mem/block) pointing to a path in a nonexistent directory, a path without write permission, or a directory instead of a file: os.Create inside initProfiling fails and the wrapped error is returned during option finalization.
Common situations: Profiling in containers or restricted environments where the target directory is read-only; relative profile paths resolved from an unexpected working directory; disk full; leftover root-owned profile files from a previous sudo run.
Related errors
- could not create CPU profile: %w
- could not create MEM profile: %w
- could not create BLOCK profile: %w
- could not create MUTEX profile: %w
- no directory specified
AI-assisted analysis of junegunn/fzf@bd4efa277b (2026-08-15).
Data as JSON: /api/errors/1da60f73a96793e1.
Report an issue: GitHub.