{"record":{"id":"03ee19cfaf25de33","repo":"juicedata/juicefs","slug":"failed-to-get-pprof-port-v","errorCode":null,"errorMessage":"failed to get pprof port: %v","messagePattern":"failed to get pprof port: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/debug.go","lineNumber":362,"sourceCode":"\t\t\t}\n\t\t\tdefer closeFile(file)\n\t\t\tif _, err := io.Copy(writer, file); err != nil {\n\t\t\t\treturn err\n\t\t\t}\n\t\t}\n\t\treturn nil\n\t})\n}\n\nfunc collectPprof(ctx *cli.Context, cmd string, pid string, amp string, requireRootPrivileges bool, currDir string, wg *sync.WaitGroup) error {\n\tif !checkAgent(cmd) {\n\t\tlogger.Warnf(\"No agent found, the pprof metrics will not be collected\")\n\t\treturn nil\n\t}\n\n\tport, err := getPprofPort(pid, amp, requireRootPrivileges)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"failed to get pprof port: %v\", err)\n\t}\n\tbaseUrl := fmt.Sprintf(\"http://localhost:%d/debug/pprof/\", port)\n\tlogger.Infof(\"The pprof base url: %s\", baseUrl)\n\ttrace := ctx.Uint64(\"trace-sec\")\n\tprofile := ctx.Uint64(\"profile-sec\")\n\tmetrics := map[string]metricItem{\n\t\t\"allocs\":       {name: \"allocs.pb.gz\", url: baseUrl + \"allocs\"},\n\t\t\"blocks\":       {name: \"block.pb.gz\", url: baseUrl + \"block\"},\n\t\t\"cmdline\":      {name: \"cmdline.txt\", url: baseUrl + \"cmdline\"},\n\t\t\"goroutine\":    {name: \"goroutine.pb.gz\", url: baseUrl + \"goroutine\"},\n\t\t\"stack\":        {name: \"goroutine.stack.txt\", url: baseUrl + \"goroutine?debug=1\"},\n\t\t\"stack-detail\": {name: \"goroutine.stack.detail.txt\", url: baseUrl + \"goroutine?debug=2\"},\n\t\t\"heap\":         {name: \"heap.pb.gz\", url: baseUrl + \"heap\"},\n\t\t\"mutex\":        {name: \"mutex.pb.gz\", url: baseUrl + \"mutex\"},\n\t\t\"threadcreate\": {name: \"threadcreate.pb.gz\", url: baseUrl + \"threadcreate\"},\n\t\t\"trace\":        {name: fmt.Sprintf(\"trace.%ds.pb.gz\", trace), url: fmt.Sprintf(\"%strace?seconds=%d\", baseUrl, trace)},\n\t\t\"profile\":      {name: fmt.Sprintf(\"profile.%ds.pb.gz\", profile), url: fmt.Sprintf(\"%sprofile?seconds=%d\", baseUrl, profile)},\n\t}","sourceCodeStart":344,"sourceCodeEnd":380,"githubUrl":"https://github.com/juicedata/juicefs/blob/c9a67b23e8e08ec23ec331aa6f1675e2319e921c/cmd/debug.go#L344-L380","documentation":"Returned by collectPprof during `juicefs debug` when the pprof port of the target mount process cannot be determined (port discovery via the agent or process inspection failed). Without the port no profiling data can be fetched.","triggerScenarios":"Thrown at cmd/debug.go:362 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Verify the agent is running and the mount process exists","Check that the debug agent port was registered for the mount"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"c9a67b23e8e08ec23ec331aa6f1675e2319e921c","analyzedAt":"2026-09-06T17:55:48.476Z","contentChangedAt":"2026-09-06T17:55:48.476Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}