chenhg5/cc-connect · error

session %q is busy

Error message

session %q is busy

What it means

Cron run with new-session-per-run: the freshly created side session's TryLock failed, meaning that cron session is still processing a previous run. The current run is skipped rather than queued or double-executed.

Source

Thrown at core/engine.go:1629

			workspaceDir = job.WorkDir
		} else {
			slog.Warn("cron: workspace agent creation failed, using global",
				"work_dir", job.WorkDir, "session_key", sessionKey, "error", err)
		}
	}

	useNewSession := false
	if e.cronScheduler != nil {
		useNewSession = e.cronScheduler.UsesNewSession(job)
	} else {
		useNewSession = job.UsesNewSessionPerRun()
	}

	if useNewSession {
		msg.SessionKey = runSessionKey
		session := sessions.NewSideSession(runSessionKey, "cron-"+job.ID)
		if !session.TryLock() {
			return fmt.Errorf("session %q is busy", runSessionKey)
		}
		iKey := fmt.Sprintf("%s#cron:%s", runSessionKey, session.ID)
		if workspaceDir != "" {
			iKey = workspaceDir + ":" + iKey
		}
		prevHistLen := session.HistoryLen()
		e.processInteractiveMessageWith(effectivePlatform, msg, session, agent, sessions, iKey, workspaceDir, runSessionKey)
		e.cleanupInteractiveState(iKey)
		// Empty-response detection via session history delta: processInteractiveMessageWith
		// always adds a "user" entry (prevHistLen+1), then an "assistant" entry on success
		// (prevHistLen+2). This approach correctly detects empty responses across all
		// delivery modes (plain text, cards, rich cards, DingTalk AI streaming) because
		// AddHistory("assistant",...) is called before any platform-specific rendering path.
		if !job.Mute && session.HistoryLen() < prevHistLen+2 {
			return fmt.Errorf("cron job %q produced an empty response", job.ID)
		}
		return nil
	}

View on GitHub (pinned to 4000b2338a)

Solutions

  1. Wait for the overlapping run to finish or lengthen the cron schedule
  2. Disable use_new_session_per_run so runs share the serialized main session
Defensive patterns

Strategy: retry

When it happens

Trigger: Thrown at core/engine.go:1629 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of chenhg5/cc-connect@4000b2338a (2026-09-06). Data as JSON: /api/errors/b718a843bce3aa7d. Report an issue: GitHub.