chenhg5/cc-connect · critical
generate cron id: %w
Error message
generate cron id: %w
What it means
GenerateCronID reads 4 random bytes from crypto/rand to build a hex job id; if the OS entropy source fails, it panics with 'generate cron id: %w'. This is treated as an unrecoverable environment failure because unique ids cannot be produced without it.
Source
Thrown at core/cron.go:739
} else {
slog.Info("cron: job completed", "id", job.ID, "manual", manual)
}
}
// mutePlatform wraps a Platform and discards all outgoing messages.
// Used for muted cron jobs that should execute without sending chat messages.
type mutePlatform struct {
Platform
}
func (m *mutePlatform) Reply(_ context.Context, _ any, _ string) error { return nil }
func (m *mutePlatform) Send(_ context.Context, _ any, _ string) error { return nil }
func GenerateCronID() string {
b := make([]byte, 4)
if _, err := rand.Read(b); err != nil {
panic(fmt.Errorf("generate cron id: %w", err))
}
return hex.EncodeToString(b)
}
func truncateStr(s string, n int) string {
runes := []rune(s)
if len(runes) <= n {
return s
}
return string(runes[:n]) + "..."
}
var cronWeekdays = map[Language][7]string{
LangEnglish: {"Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"},
LangChinese: {"周日", "周一", "周二", "周三", "周四", "周五", "周六"},
LangTraditionalChinese: {"週日", "週一", "週二", "週三", "週四", "週五", "週六"},
LangJapanese: {"日曜", "月曜", "火曜", "水曜", "木曜", "金曜", "土曜"},
LangSpanish: {"domingo", "lunes", "martes", "miércoles", "jueves", "viernes", "sábado"},View on GitHub (pinned to 4000b2338a)
Solutions
- Restore /dev/urandom access or unblock the getrandom syscall in the sandbox/seccomp profile
- Restart the daemon on a properly configured host
- Wrap the call site to recover from the panic if ids can be supplied externally
Example fix
// before
id := core.GenerateCronID() // panics if entropy unavailable
// after
func safeCronID() (id string, err error) {
defer func() { if r := recover(); r != nil { err = fmt.Errorf("cron id: %v", r) } }()
return core.GenerateCronID(), nil
} Defensive patterns
Strategy: try-catch
Try / catch
func safeCronID() (id string, err error) {
defer func() { if r := recover(); r != nil { err = fmt.Errorf("generate cron id: %v", r) } }()
return core.GenerateCronID(), nil
} Prevention
- Ensure /dev/urandom is available and getrandom is permitted in containers/seccomp profiles
- Recover from this panic at command-handler boundaries so a bad environment degrades gracefully
When it happens
Trigger: rand.Read failing due to a broken/depleted /dev/urandom, a seccomp/sandbox policy blocking the getrandom syscall, or running in a container without proper entropy device setup.
Common situations: Hardened containers restricting syscalls, chroot environments missing /dev/urandom, or exotic OS images with misconfigured entropy.
Understand the failure class
Background: "environment variable is not set" and "Missing keys in environment" errors: what missing required env var messages mean and how to fix them — this error's family across 28 libraries.
Related errors
- generate permission bridge token: %w
- listen for Agy permission hooks: %w
- resolve home directory for Agy permission bridge: %w
- create Agy permission overlay: %w
- parse existing Agy hooks %s: %w
AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06).
Data as JSON: /api/errors/5aa33e1e6c217eef.
Report an issue: GitHub.