{"record":{"id":"ab459fa3af73f9dd","repo":"junegunn/fzf","slug":"socket-already-in-use-s","errorCode":null,"errorMessage":"socket already in use: %s","messagePattern":"socket already in use: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src/server.go","lineNumber":96,"sourceCode":"\treturn listenAddress{parts[0], port, \"\"}, nil\n}\n\nfunc startHttpServer(address listenAddress, actionChannel chan []*action, getHandler func(getParams) string) (net.Listener, int, error) {\n\thost := address.host\n\tport := address.port\n\tapiKey := os.Getenv(\"FZF_API_KEY\")\n\tif !address.IsLocal() && len(apiKey) == 0 {\n\t\treturn nil, port, errors.New(\"FZF_API_KEY is required to allow remote access\")\n\t}\n\n\tvar listener net.Listener\n\tvar err error\n\tif len(address.sock) > 0 {\n\t\tif _, err := os.Stat(address.sock); err == nil {\n\t\t\t// Check if the socket is already in use\n\t\t\tif conn, err := net.Dial(\"unix\", address.sock); err == nil {\n\t\t\t\tconn.Close()\n\t\t\t\treturn nil, 0, fmt.Errorf(\"socket already in use: %s\", address.sock)\n\t\t\t}\n\t\t\tos.Remove(address.sock)\n\t\t}\n\t\tlistener, err = net.Listen(\"unix\", address.sock)\n\t\tif err != nil {\n\t\t\treturn nil, 0, fmt.Errorf(\"failed to listen on %s\", address.sock)\n\t\t}\n\t\tos.Chmod(address.sock, 0600)\n\t} else {\n\t\taddrStr := fmt.Sprintf(\"%s:%d\", host, port)\n\t\tlistener, err = net.Listen(\"tcp\", addrStr)\n\t\tif err != nil {\n\t\t\treturn nil, port, fmt.Errorf(\"failed to listen on %s\", addrStr)\n\t\t}\n\t\tif port == 0 {\n\t\t\taddr := listener.Addr().String()\n\t\t\tparts := strings.Split(addr, \":\")\n\t\t\tif len(parts) < 2 {","sourceCodeStart":78,"sourceCodeEnd":114,"githubUrl":"https://github.com/junegunn/fzf/blob/bd4efa277b49ef34ca4025bff9b1a288e1980eff/src/server.go#L78-L114","documentation":"Error \"socket already in use: %s\" thrown in junegunn/fzf.","triggerScenarios":"Thrown at src/server.go:96 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Remove the stale socket file and retry: rm <socket-path>","Stop the process currently bound to the socket, then retry","Point --listen at a different socket path or TCP port"],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"bd4efa277b49ef34ca4025bff9b1a288e1980eff","analyzedAt":"2026-08-15T06:11:46.983Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}