{"record":{"id":"afb2762e9c2e69fc","repo":"chenhg5/cc-connect","slug":"cron-job-q-produced-an-empty-response","errorCode":null,"errorMessage":"cron job %q produced an empty response","messagePattern":"cron job %q produced an empty response","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/engine.go","lineNumber":1644,"sourceCode":"\t\tmsg.SessionKey = runSessionKey\n\t\tsession := sessions.NewSideSession(runSessionKey, \"cron-\"+job.ID)\n\t\tif !session.TryLock() {\n\t\t\treturn fmt.Errorf(\"session %q is busy\", runSessionKey)\n\t\t}\n\t\tiKey := fmt.Sprintf(\"%s#cron:%s\", runSessionKey, session.ID)\n\t\tif workspaceDir != \"\" {\n\t\t\tiKey = workspaceDir + \":\" + iKey\n\t\t}\n\t\tprevHistLen := session.HistoryLen()\n\t\te.processInteractiveMessageWith(effectivePlatform, msg, session, agent, sessions, iKey, workspaceDir, runSessionKey)\n\t\te.cleanupInteractiveState(iKey)\n\t\t// Empty-response detection via session history delta: processInteractiveMessageWith\n\t\t// always adds a \"user\" entry (prevHistLen+1), then an \"assistant\" entry on success\n\t\t// (prevHistLen+2). This approach correctly detects empty responses across all\n\t\t// delivery modes (plain text, cards, rich cards, DingTalk AI streaming) because\n\t\t// AddHistory(\"assistant\",...) is called before any platform-specific rendering path.\n\t\tif !job.Mute && session.HistoryLen() < prevHistLen+2 {\n\t\t\treturn fmt.Errorf(\"cron job %q produced an empty response\", job.ID)\n\t\t}\n\t\treturn nil\n\t}\n\n\tsession := sessions.GetOrCreateActive(sessionKey)\n\tif !session.TryLock() {\n\t\treturn fmt.Errorf(\"session %q is busy\", sessionKey)\n\t}\n\n\tiKey := sessionKey\n\tif workspaceDir != \"\" {\n\t\tiKey = workspaceDir + \":\" + sessionKey\n\t}\n\tprevHistLen := session.HistoryLen()\n\te.processInteractiveMessageWith(effectivePlatform, msg, session, agent, sessions, iKey, workspaceDir, sessionKey)\n\t// Same empty-response detection as the useNewSession path above.\n\tif !job.Mute && session.HistoryLen() < prevHistLen+2 {\n\t\treturn fmt.Errorf(\"cron job %q produced an empty response\", job.ID)","sourceCodeStart":1626,"sourceCodeEnd":1662,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/engine.go#L1626-L1662","documentation":"Post-run empty-response guard: after processInteractiveMessageWith, the session history length did not increase, so the cron job produced no assistant response (agent exited silently, errored, or the prompt yielded nothing). Surfaced as the cron run's result instead of failing invisibly.","triggerScenarios":"Thrown at core/engine.go:1644 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Run the prompt manually against the agent CLI in that workspace","Inspect agent logs; verify the job prompt/template is non-empty and the agent binary works"],"exampleFix":null,"handlingStrategy":"fallback","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}