{"record":{"id":"64f3e0c5ef255b0d","repo":"fatedier/frp","slug":"generate-random-id-error-v","errorCode":null,"errorMessage":"generate random id error: %v","messagePattern":"generate random id error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/ssh/server.go","lineNumber":298,"sourceCode":"\t\treturn nil, nil, helpMessage, fmt.Errorf(\"new proxy configurer error\")\n\t}\n\tconfig.RegisterProxyFlags(cmd, pc, config.WithSSHMode())\n\n\tclientCfg := v1.ClientCommonConfig{}\n\tconfig.RegisterClientCommonConfigFlags(cmd, &clientCfg, config.WithSSHMode())\n\n\tcmd.InitDefaultHelpCmd()\n\tif err := cmd.ParseFlags(args); err != nil {\n\t\tif errors.Is(err, flag.ErrHelp) {\n\t\t\thelpMessage = cmd.UsageString()\n\t\t}\n\t\treturn nil, nil, helpMessage, err\n\t}\n\t// if name is not set, generate a random one\n\tif pc.GetBaseConfig().Name == \"\" {\n\t\tid, err := util.RandIDWithLen(8)\n\t\tif err != nil {\n\t\t\treturn nil, nil, helpMessage, fmt.Errorf(\"generate random id error: %v\", err)\n\t\t}\n\t\tpc.GetBaseConfig().Name = fmt.Sprintf(\"sshtunnel-%s-%s\", proxyType, id)\n\t}\n\treturn &clientCfg, pc, helpMessage, nil\n}\n\nfunc (s *TunnelServer) handleNewChannel(channel ssh.NewChannel, extraPayloadCh chan string) {\n\tch, reqs, err := channel.Accept()\n\tif err != nil {\n\t\treturn\n\t}\n\ts.firstChannelMu.Lock()\n\tif s.firstChannel == nil {\n\t\ts.firstChannel = ch\n\t}\n\ts.firstChannelMu.Unlock()\n\tgo s.keepAlive(ch)\n","sourceCodeStart":280,"sourceCodeEnd":316,"githubUrl":"https://github.com/fatedier/frp/blob/6c8a8d0a97d03b44e9528d30b30c70cb9d61b405/pkg/ssh/server.go#L280-L316","documentation":"Emitted when util.RandIDWithLen(8) fails while generating a random proxy name for an SSH tunnel whose --name flag was omitted (default name becomes sshtunnel-<type>-<random8>). RandIDWithLen reads from crypto/rand, so failure means the system entropy source is unavailable — an extremely rare condition on healthy hosts.","triggerScenarios":"crypto/rand read errors: exhausted entropy at early boot on embedded/minimal VMs, a broken /dev/urandom in a badly built container, or file-descriptor exhaustion preventing the open. Requires the client to also have omitted the proxy name.","commonSituations":"Freshly booted minimal VMs or containers that block /dev/random; seccomp profiles in hardened containers denying getrandom(2); virtually never on normal Linux/macOS hosts.","solutions":["Sidestep entirely by passing an explicit name: add --name my-tunnel to the ssh command.","If it recurs, check the host entropy: cat /proc/sys/kernel/random/entropy_avail and confirm /dev/urandom is readable inside the container.","Relax overly strict seccomp/sandbox profiles to allow the getrandom syscall."],"exampleFix":"# before\nssh v0@frps \"tcp 127.0.0.1:22 --remotePort 6000\"\n\n# after\nssh v0@frps \"tcp 127.0.0.1:22 --remotePort 6000 --name my-ssh-tunnel\"","handlingStrategy":"validation","validationCode":"# sidestep randomness entirely: always name your tunnels\nssh v0@frps \"tcp 127.0.0.1:22 --remotePort 6000 --name prod-tunnel\"","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass --name for deterministic, retry-safe tunnel identity.","Verify /dev/urandom is readable and getrandom(2) is allowed in hardened containers.","Avoid starting services in the first seconds after boot on minimal VMs."],"tags":["ssh","random","entropy","environment"],"backgroundTag":null,"analyzedSha":"6c8a8d0a97d03b44e9528d30b30c70cb9d61b405","analyzedAt":"2026-08-15T06:53:27.215Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}