sipeed/picoclaw · error

error setting up cron service

Error message

error setting up cron service: %w

What it means

setupAndStartServices wraps a setupCronTool failure: the cron service (scheduled task runner) could not be initialized from cfg.Tools.Cron (bad workspace path, config issue). Gateway startup fails since cron is a core service.

Solutions

  1. Check the wrapped cause and the tools.cron settings in config.json
  2. Verify the workspace path exists and is accessible
  3. Adjust tools.cron.exec_timeout_minutes to a valid positive value
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at pkg/gateway/gateway.go:426 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of sipeed/picoclaw@49183d7e8d (2026-08-15). Data as JSON: /api/errors/cd6b8bc956741287. Report an issue: GitHub.

Appendix: source

Thrown at pkg/gateway/gateway.go:426

	agentLoop *agent.AgentLoop,
	msgBus *bus.MessageBus,
	authToken string,
	listenResult netbind.OpenResult,
) (*services, error) {
	runningServices := &services{}

	execTimeout := time.Duration(cfg.Tools.Cron.ExecTimeoutMinutes) * time.Minute
	var err error
	runningServices.CronService, err = setupCronTool(
		agentLoop,
		msgBus,
		cfg.WorkspacePath(),
		cfg.Agents.Defaults.RestrictToWorkspace,
		execTimeout,
		cfg,
	)
	if err != nil {
		return nil, fmt.Errorf("error setting up cron service: %w", err)
	}
	if err = runningServices.CronService.Start(); err != nil {
		return nil, fmt.Errorf("error starting cron service: %w", err)
	}
	fmt.Println("✓ Cron service started")

	runningServices.HeartbeatService = heartbeat.NewHeartbeatService(
		cfg.WorkspacePath(),
		cfg.Heartbeat.Interval,
		cfg.Heartbeat.Enabled,
	)
	runningServices.HeartbeatService.SetBus(msgBus)
	runningServices.HeartbeatService.SetHandler(createHeartbeatHandler(agentLoop))
	if err = runningServices.HeartbeatService.Start(); err != nil {
		return nil, fmt.Errorf("error starting heartbeat service: %w", err)
	}
	fmt.Println("✓ Heartbeat service started")

View on GitHub (pinned to 49183d7e8d)