{"record":{"id":"ac04cd6ead942b32","repo":"hashicorp/nomad","slug":"unable-to-create-unix-socket-for-consul-grpc-endpo","errorCode":null,"errorMessage":"unable to create unix socket for Consul gRPC endpoint: %v","messagePattern":"unable to create unix socket for Consul gRPC endpoint: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"client/allocrunner/consul_grpc_sock_hook.go","lineNumber":290,"sourceCode":"\t\tsocketFile = filepath.Join(allocdir.SharedAllocName, allocdir.TmpDirName,\n\t\t\t\"consul_\"+p.config.Name+\"_grpc.sock\")\n\t}\n\thostGRPCSocketPath := filepath.Join(p.allocDir.AllocDirPath(), socketFile)\n\n\t// if the socket already exists we'll try to remove it, but if not then any\n\t// other errors will bubble up to the caller here or when we try to listen\n\t_, err := os.Stat(hostGRPCSocketPath)\n\tif err == nil {\n\t\terr := os.Remove(hostGRPCSocketPath)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\n\t\t\t\t\"unable to remove existing unix socket for Consul gRPC endpoint: %v\", err)\n\t\t}\n\t}\n\n\tlistener, err := net.Listen(\"unix\", hostGRPCSocketPath)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"unable to create unix socket for Consul gRPC endpoint: %v\", err)\n\t}\n\n\t// The gRPC socket should be usable by all users in case a task is\n\t// running as an unprivileged user.  Unix does not allow setting domain\n\t// socket permissions when creating the file, so we must manually call\n\t// chmod afterwards.\n\t// https://github.com/golang/go/issues/11822\n\tif err := os.Chmod(hostGRPCSocketPath, os.ModePerm); err != nil {\n\t\treturn fmt.Errorf(\"unable to set permissions on unix socket for Consul gRPC endpoint: %v\", err)\n\t}\n\n\tgo func() {\n\t\tproxy(p.ctx, p.logger, destAddr, listener)\n\t\tp.cancel()\n\t\tclose(p.doneCh)\n\t}()\n\n\tp.runOnce = true","sourceCodeStart":272,"sourceCodeEnd":308,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/client/allocrunner/consul_grpc_sock_hook.go#L272-L308","documentation":"net.Listen(\"unix\", hostGRPCSocketPath) failed while creating the Consul gRPC unix socket, typically due to permissions on the alloc dir, a path length issue, or filesystem errors; the proxy cannot serve Envoy's gRPC connection.","triggerScenarios":"Thrown at client/allocrunner/consul_grpc_sock_hook.go:290 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check alloc dir permissions and free disk space","Verify no leftover socket file blocks the bind","Confirm the socket path length is within unix socket limits","Check filesystem errors in dmesg/client logs"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}