{"record":{"id":"59f1ee07e7c27b9b","repo":"chenhg5/cc-connect","slug":"resolve-timer-reply-target-w","errorCode":null,"errorMessage":"resolve timer reply target: %w","messagePattern":"resolve timer reply target: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"core/engine.go","lineNumber":1720,"sourceCode":"\t}\n\tif targetPlatform == nil {\n\t\treturn fmt.Errorf(\"platform %q not found for session %q\", platformName, sessionKey)\n\t}\n\n\trc, ok := targetPlatform.(ReplyContextReconstructor)\n\tif !ok {\n\t\treturn fmt.Errorf(\"platform %q does not support proactive messaging (timer)\", platformName)\n\t}\n\n\trunSessionKey := sessionKey\n\tvar replyCtx any\n\tvar err error\n\tif !job.Mute {\n\t\tif resolver, ok := targetPlatform.(CronReplyTargetResolver); ok {\n\t\t\tresolvedSessionKey, resolvedReplyCtx, err := resolver.ResolveCronReplyTarget(sessionKey, timerRunTitle(job))\n\t\t\tif err != nil {\n\t\t\t\tif !errors.Is(err, ErrNotSupported) {\n\t\t\t\t\treturn fmt.Errorf(\"resolve timer reply target: %w\", err)\n\t\t\t\t}\n\t\t\t} else {\n\t\t\t\tif resolvedSessionKey != \"\" {\n\t\t\t\t\trunSessionKey = resolvedSessionKey\n\t\t\t\t}\n\t\t\t\tif resolvedReplyCtx != nil {\n\t\t\t\t\treplyCtx = resolvedReplyCtx\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t}\n\tif replyCtx == nil {\n\t\treplyCtx, err = rc.ReconstructReplyCtx(runSessionKey)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"reconstruct reply context: %w\", err)\n\t\t}\n\t}\n","sourceCodeStart":1702,"sourceCodeEnd":1738,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/core/engine.go#L1702-L1738","documentation":"Wraps a failure from ResolveCronReplyTarget when a platform implementing CronReplyTargetResolver fails to resolve the reply target for a timer job. Returned only when the error is not ErrNotSupported; ErrNotSupported is silently tolerated and defaults are used.","triggerScenarios":"Platform's ResolveCronReplyTarget returns a non-ErrNotSupported error while preparing a timer run (e.g. API call to resolve chat fails).","commonSituations":"Platform API outage or expired credentials when resolving the target chat; platform adapter bug in target resolution logic.","solutions":["Inspect the wrapped cause (%w) for the underlying platform API error","Verify platform credentials/tokens are valid","Retry the timer job; if transient, the next run may succeed","Return ErrNotSupported from the resolver if resolution is intentionally unavailable, so the engine uses defaults"],"exampleFix":"// before\nreturn nil, nil, fmt.Errorf(\"chat gone\")\n// after\nreturn nil, nil, core.ErrNotSupported // fall back to default session key/ctx","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if err := runTimerJob(job); err != nil { if errors.Is(err, platformAPIErr) { retryLater(job) } }","preventionTips":["Return core.ErrNotSupported for unsupported resolutions so the engine degrades gracefully","Validate platform credentials before scheduling timers","Log the wrapped cause (%w chain) for diagnosis"],"tags":["go","timer","resolution"],"backgroundTag":"upstream-api-error","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"}