{"record":{"id":"3ab88b4fff9cabf8","repo":"wavetermdev/waveterm","slug":"generating-badge-id-v","errorCode":null,"errorMessage":"generating badge id: %v","messagePattern":"generating badge id: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"cmd/wsh/cmd/wshcmd-badge.go","lineNumber":77,"sourceCode":"\t\treturn fmt.Errorf(\"resolving block: %v\", err)\n\t}\n\tif oref.OType != waveobj.OType_Block && oref.OType != waveobj.OType_Tab {\n\t\treturn fmt.Errorf(\"badge oref must be a block or tab (got %q)\", oref.OType)\n\t}\n\n\tvar eventData baseds.BadgeEvent\n\teventData.ORef = oref.String()\n\n\tif badgeClear {\n\t\teventData.Clear = true\n\t} else {\n\t\ticon := \"circle-small\"\n\t\tif len(args) > 0 {\n\t\t\ticon = args[0]\n\t\t}\n\t\tbadgeId, err := uuid.NewV7()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"generating badge id: %v\", err)\n\t\t}\n\t\teventData.Badge = &baseds.Badge{\n\t\t\tBadgeId:   badgeId.String(),\n\t\t\tIcon:      icon,\n\t\t\tColor:     badgeColor,\n\t\t\tPriority:  badgePriority,\n\t\t\tPidLinked: badgePid > 0,\n\t\t}\n\t}\n\n\tevent := wps.WaveEvent{\n\t\tEvent:  wps.Event_Badge,\n\t\tScopes: []string{oref.String()},\n\t\tData:   eventData,\n\t}\n\n\terr = wshclient.EventPublishCommand(RpcClient, event, &wshrpc.RpcOpts{NoResponse: true})\n\tif err != nil {","sourceCodeStart":59,"sourceCodeEnd":95,"githubUrl":"https://github.com/wavetermdev/waveterm/blob/a4447c1563b2df285ab89e76c82f91e1a1a49c1e/cmd/wsh/cmd/wshcmd-badge.go#L59-L95","documentation":"When setting (not clearing) a badge, badgeRun generates a unique badge id with uuid.NewV7(). If UUID generation fails (e.g. insufficient system entropy), the error is wrapped as \"generating badge id: %v\".","triggerScenarios":"uuid.NewV7() returns an error — typically crypto/rand unavailable or the underlying entropy source failing on the host.","commonSituations":"Running in a heavily restricted container/OS sandbox where /dev/urandom or the crypto entropy pool is unavailable; corrupted Go crypto runtime — rare in practice.","solutions":["Check the host's entropy source is available (e.g. /dev/urandom readable inside containers).","Re-run the command — entropy failures are often transient.","Fix container security settings (seccomp/device restrictions) that block random device access."],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":"badgeId, err := uuid.NewV7()\nif err != nil {\n    // retry once; if persistent, check host entropy (/dev/urandom)\n}","preventionTips":["Ensure containers can read /dev/urandom.","Retry transient entropy failures.","Keep the Go crypto runtime up to date."],"tags":["uuid","entropy","cli"],"backgroundTag":"uuid-generation-failed","analyzedSha":"a4447c1563b2df285ab89e76c82f91e1a1a49c1e","analyzedAt":"2026-09-01T15:26:23.972Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}