{"record":{"id":"d144d60de8a816f2","repo":"junegunn/fzf","slug":"could-not-create-mem-profile-w","errorCode":null,"errorMessage":"could not create MEM profile: %w","messagePattern":"could not create MEM profile: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/options_pprof.go","lineNumber":46,"sourceCode":"\t\t\tif err := f.Close(); err != nil {\n\t\t\t\tfmt.Fprintln(os.Stderr, \"Error: closing cpu profile:\", err)\n\t\t\t}\n\t\t})\n\t}\n\n\tstopProfile := func(name string, f *os.File) {\n\t\tif err := pprof.Lookup(name).WriteTo(f, 0); err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Error: could not write %s profile: %v\\n\", name, err)\n\t\t}\n\t\tif err := f.Close(); err != nil {\n\t\t\tfmt.Fprintf(os.Stderr, \"Error: closing %s profile: %v\\n\", name, err)\n\t\t}\n\t}\n\n\tif o.MEMProfile != \"\" {\n\t\tf, err := os.Create(o.MEMProfile)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not create MEM profile: %w\", err)\n\t\t}\n\t\tutil.AtExit(func() {\n\t\t\truntime.GC()\n\t\t\tstopProfile(\"allocs\", f)\n\t\t})\n\t}\n\n\tif o.BlockProfile != \"\" {\n\t\truntime.SetBlockProfileRate(1)\n\t\tf, err := os.Create(o.BlockProfile)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not create BLOCK profile: %w\", err)\n\t\t}\n\t\tutil.AtExit(func() { stopProfile(\"block\", f) })\n\t}\n\n\tif o.MutexProfile != \"\" {\n\t\truntime.SetMutexProfileFraction(1)","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/junegunn/fzf/blob/bd4efa277b49ef34ca4025bff9b1a288e1980eff/src/options_pprof.go#L28-L64","documentation":"In a pprof build, fzf could not create the memory-profile output file specified by --profile-mem. os.Create failed and the wrapped error carries the OS-level reason; startup aborts before the memory profile is registered.","triggerScenarios":"Passing --profile-mem with a path whose directory is missing or unwritable, or naming an existing directory as the file.","commonSituations":"Same shape as other profile-path errors: stale temp dirs, permission-restricted output dirs, typos in the flag value.","solutions":["mkdir -p the target directory","Use an absolute path under a writable location like /tmp","Verify with touch on the exact path before rerunning"],"exampleFix":"# before\nfzf --profile-mem /run/mem.prof   # /run not writable\n# after\nfzf --profile-mem /tmp/mem.prof","handlingStrategy":"validation","validationCode":"mkdir -p /tmp/fzf-prof && touch /tmp/fzf-prof/mem.prof 2>/dev/null || exit 1\nfzf --profile-mem /tmp/fzf-prof/mem.prof","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Pre-create and touch the exact output path before starting","Keep all four profile outputs in one pre-made directory"],"tags":["fzf","pprof","profiling","memory","filesystem"],"backgroundTag":null,"analyzedSha":"bd4efa277b49ef34ca4025bff9b1a288e1980eff","analyzedAt":"2026-08-15T06:11:46.983Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}