{"record":{"id":"161f359cf2644ea9","repo":"chenhg5/cc-connect","slug":"job-timed-out-after-v-161f35","errorCode":null,"errorMessage":"job timed out after %v","messagePattern":"job timed out after (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/timer.go","lineNumber":422,"sourceCode":"\t\tslog.Error(\"timer: project not found\", \"job\", jobID, \"project\", job.Project)\n\t\tts.store.MarkFired(jobID, fmt.Errorf(\"project %q not found\", job.Project))\n\t\treturn\n\t}\n\n\tslog.Info(\"timer: executing job\", \"id\", jobID, \"project\", job.Project, \"prompt\", truncateStr(job.Prompt, 60))\n\n\tdone := make(chan error, 1)\n\tgo func() {\n\t\tdone <- engine.ExecuteTimerJob(job)\n\t}()\n\n\tvar err error\n\ttimeout := job.ExecutionTimeout()\n\tif timeout > 0 {\n\t\tselect {\n\t\tcase err = <-done:\n\t\tcase <-time.After(timeout):\n\t\t\terr = fmt.Errorf(\"job timed out after %v\", timeout)\n\t\t}\n\t} else {\n\t\terr = <-done\n\t}\n\n\tts.store.MarkFired(jobID, err)\n\n\tif err != nil {\n\t\tslog.Error(\"timer: job failed\", \"id\", jobID, \"error\", err)\n\t} else {\n\t\tslog.Info(\"timer: job completed\", \"id\", jobID)\n\t}\n}\n\nfunc GenerateTimerID() string {\n\tb := make([]byte, 4)\n\tif _, err := rand.Read(b); err != nil {\n\t\tpanic(fmt.Errorf(\"generate timer id: %w\", err))","sourceCodeStart":404,"sourceCodeEnd":440,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/timer.go#L404-L440","documentation":"executeJob waits for the agent run to finish via a done channel; when job.ExecutionTimeout() is positive and elapses before completion, the wait is abandoned and err is set to \"job timed out after <timeout>\". MarkFired stores this error on the job. Timeouts only apply when ExecutionTimeout() > 0 — zero/negative means wait indefinitely.","triggerScenarios":"A timer job whose prompt triggers a long agent run (big refactor, slow tool) exceeding TimeoutMins; a hung agent process that never sends completion; a timeout configured too aggressively for the workload.","commonSituations":"timeout_mins set to 1-2 minutes while the prompt legitimately needs 10; agent waiting on a permission prompt nobody is present to approve; network slowdowns making tool calls exceed the budget.","solutions":["Increase TimeoutMins on the job to comfortably exceed the worst-case run duration.","Set TimeoutMins to 0 (or leave nil per ExecutionTimeout semantics) to disable the timeout for long-running jobs.","Reduce the prompt scope so the run finishes faster; split big tasks into multiple scheduled jobs.","Investigate why the agent hung (permission prompts, stuck tool) — a timeout is masking a blocked session; check job logs for the last activity."],"exampleFix":"// before\nto := 2\nsched.AddJob(&core.TimerJob{SessionKey: k, ScheduledAt: when, Prompt: \"refactor entire module\", TimeoutMins: &to})\n// after\nto := 30\nsched.AddJob(&core.TimerJob{SessionKey: k, ScheduledAt: when, Prompt: \"refactor entire module\", TimeoutMins: &to})","handlingStrategy":"try-catch","validationCode":"// budget the timeout against expected work\nif job.TimeoutMins != nil && *job.TimeoutMins > 0 && *job.TimeoutMins < expectedMins { warn(\"timeout likely too small\") }","typeGuard":null,"tryCatchPattern":"// after AddJob, inspect the recorded outcome\nif rec, ok := store.Fired(job.ID); ok && strings.Contains(rec.Error, \"timed out\") {\n    slog.Warn(\"timer job hit timeout, increasing budget\", \"id\", job.ID)\n    sched.AddJob(cloneWithTimeout(job, *job.TimeoutMins*2))\n}","preventionTips":["Set TimeoutMins generously above worst-case agent run time","Watch for permission prompts blocking unattended timer runs — pre-approve or use bypassPermissions","Monitor MarkFired records for repeated timeout patterns and split oversized prompts"],"tags":["timer","timeout","scheduler"],"backgroundTag":"request-timeout","analyzedSha":"4000b2338aa6e850c99df54f8b0ed6ed7460b401","analyzedAt":"2026-09-06T11:45:09.575Z","contentChangedAt":"2026-09-06T11:45:09.575Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}