{"record":{"id":"211d3d87f2c315e3","repo":"sipeed/picoclaw","slug":"error-starting-cron-service-w","errorCode":null,"errorMessage":"error starting cron service: %w","messagePattern":"error starting cron service: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/gateway/gateway.go","lineNumber":429,"sourceCode":"\tlistenResult netbind.OpenResult,\n) (*services, error) {\n\trunningServices := &services{}\n\n\texecTimeout := time.Duration(cfg.Tools.Cron.ExecTimeoutMinutes) * time.Minute\n\tvar err error\n\trunningServices.CronService, err = setupCronTool(\n\t\tagentLoop,\n\t\tmsgBus,\n\t\tcfg.WorkspacePath(),\n\t\tcfg.Agents.Defaults.RestrictToWorkspace,\n\t\texecTimeout,\n\t\tcfg,\n\t)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"error setting up cron service: %w\", err)\n\t}\n\tif err = runningServices.CronService.Start(); err != nil {\n\t\treturn nil, fmt.Errorf(\"error starting cron service: %w\", err)\n\t}\n\tfmt.Println(\"✓ Cron service started\")\n\n\trunningServices.HeartbeatService = heartbeat.NewHeartbeatService(\n\t\tcfg.WorkspacePath(),\n\t\tcfg.Heartbeat.Interval,\n\t\tcfg.Heartbeat.Enabled,\n\t)\n\trunningServices.HeartbeatService.SetBus(msgBus)\n\trunningServices.HeartbeatService.SetHandler(createHeartbeatHandler(agentLoop))\n\tif err = runningServices.HeartbeatService.Start(); err != nil {\n\t\treturn nil, fmt.Errorf(\"error starting heartbeat service: %w\", err)\n\t}\n\tfmt.Println(\"✓ Heartbeat service started\")\n\n\trunningServices.MediaStore = media.NewFileMediaStoreWithCleanup(media.MediaCleanerConfig{\n\t\tEnabled:  cfg.Tools.MediaCleanup.Enabled,\n\t\tMaxAge:   time.Duration(cfg.Tools.MediaCleanup.MaxAge) * time.Minute,","sourceCodeStart":411,"sourceCodeEnd":447,"githubUrl":"https://github.com/sipeed/picoclaw/blob/49183d7e8daed0dba89ddbb6fcb60089401d9680/pkg/gateway/gateway.go#L411-L447","documentation":"The cron service's Start() call failed inside setupAndStartServices after successful setup (scheduler could not begin running jobs). Startup aborts so the gateway never runs with a half-initialized cron subsystem.","triggerScenarios":"Thrown at pkg/gateway/gateway.go:429 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the wrapped error from the cron scheduler's Start","Verify no conflicting scheduler instance is running","Review cron job definitions for entries that block startup and restart the gateway"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"49183d7e8daed0dba89ddbb6fcb60089401d9680","analyzedAt":"2026-08-15T21:55:41.315Z","contentChangedAt":"2026-08-15T21:55:41.315Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}