{"record":{"id":"5ac9cee66673dbcc","repo":"ethereum/go-ethereum","slug":"could-not-create-random-uuid-v","errorCode":null,"errorMessage":"Could not create random uuid: %v","messagePattern":"Could not create random uuid: (.+?)","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"accounts/keystore/key.go","lineNumber":135,"sourceCode":"\taddr, err := hex.DecodeString(keyJSON.Address)\n\tif err != nil {\n\t\treturn err\n\t}\n\tprivkey, err := crypto.HexToECDSA(keyJSON.PrivateKey)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tk.Address = common.BytesToAddress(addr)\n\tk.PrivateKey = privkey\n\n\treturn nil\n}\n\nfunc newKeyFromECDSA(privateKeyECDSA *ecdsa.PrivateKey) *Key {\n\tid, err := uuid.NewRandom()\n\tif err != nil {\n\t\tpanic(fmt.Sprintf(\"Could not create random uuid: %v\", err))\n\t}\n\tkey := &Key{\n\t\tId:         id,\n\t\tAddress:    crypto.PubkeyToAddress(privateKeyECDSA.PublicKey),\n\t\tPrivateKey: privateKeyECDSA,\n\t}\n\treturn key\n}\n\n// NewKeyForDirectICAP generates a key whose address fits into < 155 bits so it can fit\n// into the Direct ICAP spec. for simplicity and easier compatibility with other libs, we\n// retry until the first byte is 0.\nfunc NewKeyForDirectICAP(rand io.Reader) *Key {\n\trandBytes := make([]byte, 64)\n\t_, err := rand.Read(randBytes)\n\tif err != nil {\n\t\tpanic(\"key generation: could not read from random source: \" + err.Error())\n\t}","sourceCodeStart":117,"sourceCodeEnd":153,"githubUrl":"https://github.com/ethereum/go-ethereum/blob/6bb0588ad8e7f922e4ad5580f51265a4097af08f/accounts/keystore/key.go#L117-L153","documentation":"newKeyFromECDSA assigns each freshly generated keystore key a random UUID (uuid.NewRandom). UUID generation requires OS entropy; if that fails the library cannot produce a valid key file identifier and panics with the underlying error. This is effectively an unrecoverable environment failure, not a usage error.","triggerScenarios":"Any key creation path — newAccount, account creation in geth/clef, NewKeyForDirectICAP — on a system where the entropy source is broken: exhausted entropy in a container/VM, /dev/urandom unavailable, or a hardened runtime blocking random reads.","commonSituations":"Minimal Docker images or chroots without /dev/urandom properly mounted, early-boot VMs with low entropy, restrictive seccomp/sandbox profiles blocking getrandom(2).","solutions":["Ensure /dev/urandom exists and is readable inside the environment (docker run with a proper /dev).","On VMs, install haveged or a virtio-rng device so entropy is available.","Check the wrapped error in the panic message to identify the blocked syscall and adjust the sandbox policy.","Retry key creation once the entropy source is fixed; pre-existing keys are unaffected."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run key generation only on hosts with a working OS entropy source.","In containers, verify /dev/urandom is mounted and readable.","Use haveged/virtio-rng on entropy-starved VMs."],"tags":["go-ethereum","keystore","uuid","entropy","panic"],"backgroundTag":null,"analyzedSha":"6bb0588ad8e7f922e4ad5580f51265a4097af08f","analyzedAt":"2026-08-15T10:06:53.996Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}