junegunn/fzf · error
could not create BLOCK profile: %w
Error message
could not create BLOCK profile: %w
What it means
In a pprof build, fzf could not create the block-profile output file specified by --profile-block. The runtime block rate is set first, then os.Create is attempted; failure aborts with the wrapped OS error.
Source
Thrown at src/options_pprof.go:58
}
}
if o.MEMProfile != "" {
f, err := os.Create(o.MEMProfile)
if err != nil {
return fmt.Errorf("could not create MEM profile: %w", err)
}
util.AtExit(func() {
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
- Create and verify the output directory: mkdir -p /tmp/prof && touch /tmp/prof/block.out
- Use /tmp or another guaranteed-writable path
- Read the wrapped error for the precise cause
Example fix
# before fzf --profile-block ./out/block.prof # ./out missing # after mkdir -p ./out && fzf --profile-block ./out/block.prof
Defensive patterns
Strategy: validation
Validate before calling
d=/tmp/fzf-prof; mkdir -p "$d" && [ -w "$d" ] || exit 1 fzf --profile-block "$d/block.prof"
Prevention
- Validate profile paths once in a wrapper script
- Avoid profiling into read-only mount points like /proc or /sys
When it happens
Trigger: Passing --profile-block with a path in a nonexistent/read-only directory or a path that is itself a directory.
Common situations: Profiling scripts assuming a scratch directory exists; read-only containers where the only writable path is /tmp.
Related errors
- failed to start pprof profiles: %s
- could not create CPU profile: %w
- could not create MEM profile: %w
- could not create MUTEX profile: %w
- error: profiling not supported: FZF must be built with '-tag
AI-assisted analysis of junegunn/fzf@bd4efa277b (2026-08-15).
Data as JSON: /api/errors/752029fa0bdda23a.
Report an issue: GitHub.