{"record":{"id":"ae4c1c5c703b1393","repo":"chenhg5/cc-connect","slug":"platform-q-not-ready","errorCode":null,"errorMessage":"platform %q not ready","messagePattern":"platform %q not ready","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/engine.go","lineNumber":283,"sourceCode":"}\n\n// clearPendingRestart removes the queued notify if it is still the same\n// request (avoids clearing a newer notify that replaced this one).\nfunc (e *Engine) clearPendingRestart(req *RestartRequest) {\n\te.pendingRestartMu.Lock()\n\tif e.pendingRestartNotify == req {\n\t\te.pendingRestartNotify = nil\n\t}\n\te.pendingRestartMu.Unlock()\n}\n\n// dispatchRestartNotify sends the notify to the target platform with up\n// to 3 attempts (initial + 2 retries) on transient failure. The\n// platform must already be ready when this is called.\nfunc (e *Engine) dispatchRestartNotify(req *RestartRequest) error {\n\tp := e.lookupReadyPlatform(req.Platform)\n\tif p == nil {\n\t\treturn fmt.Errorf(\"platform %q not ready\", req.Platform)\n\t}\n\trc, ok := p.(ReplyContextReconstructor)\n\tif !ok {\n\t\treturn fmt.Errorf(\"platform %q does not support ReconstructReplyCtx\", req.Platform)\n\t}\n\trctx, err := rc.ReconstructReplyCtx(req.SessionKey)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"reconstruct reply ctx: %w\", err)\n\t}\n\ttext := e.i18n.T(MsgRestartSuccess)\n\tif CurrentVersion != \"\" {\n\t\ttext += fmt.Sprintf(\" (%s)\", CurrentVersion)\n\t}\n\n\tbackoffs := []time.Duration{0, 500 * time.Millisecond, 1500 * time.Millisecond}\n\tvar lastErr error\n\tfor attempt, wait := range backoffs {\n\t\tif wait > 0 {","sourceCodeStart":265,"sourceCodeEnd":301,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/engine.go#L265-L301","documentation":"dispatchRestartNotify resolves the restart notification's target platform via lookupReadyPlatform; if no ready platform with that name exists it returns 'platform %q not ready'. The restart-notify path requires the platform to be connected and initialized before it can deliver the message.","triggerScenarios":"runPendingRestartNotify processing a queued RestartRequest whose target platform is disabled in config, failed to start, is still connecting, or was renamed since the request was queued.","commonSituations":"User issues a restart command and the reply platform later fails to reconnect (invalid token, network outage) before the pending notify is dispatched; config change removes the platform between queueing and dispatch.","solutions":["Verify the platform is enabled and started in config.toml and that its credentials are valid","Check platform connection logs for startup failures and restart the daemon after fixing","Retry the restart flow once the platform reports ready; stale pending requests for removed platforms should be dropped"],"exampleFix":"// before\n// telegram token invalid -> platform never ready -> notify fails\n// after\n// fix bot token in config.toml, ensure [platforms.telegram] enabled = true, restart daemon","handlingStrategy":"retry","validationCode":"if e.lookupReadyPlatform(req.Platform) == nil { return fmt.Errorf(\"platform %s not ready\", req.Platform) }","typeGuard":null,"tryCatchPattern":"if err := e.dispatchRestartNotify(req); err != nil {\n    if strings.Contains(err.Error(), \"not ready\") {\n        requeueWithBackoff(req) // retry when platform reconnects\n    }\n}","preventionTips":["Only enqueue restart notifications for platforms that are currently ready","Re-validate queued requests against active platforms before dispatch","Fix platform credentials/config so platforms reach ready state reliably"],"tags":["go","platform","startup","messaging"],"backgroundTag":"unsupported-operation","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"}