{"record":{"id":"025d2d0205c55420","repo":"chenhg5/cc-connect","slug":"weixin-not-a-weixin-session-key","errorCode":null,"errorMessage":"weixin: not a weixin session key","messagePattern":"weixin: not a weixin session key","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/weixin/weixin.go","lineNumber":909,"sourceCode":"\t\treturn []string{s}\n\t}\n\tvar out []string\n\trunes := []rune(s)\n\tfor len(runes) > 0 {\n\t\tn := maxRunes\n\t\tif len(runes) < n {\n\t\t\tn = len(runes)\n\t\t}\n\t\tout = append(out, string(runes[:n]))\n\t\trunes = runes[n:]\n\t}\n\treturn out\n}\n\n// ReconstructReplyCtx implements core.ReplyContextReconstructor for cron / proactive sends.\nfunc (p *Platform) ReconstructReplyCtx(sessionKey string) (any, error) {\n\tif !strings.HasPrefix(sessionKey, sessionKeyPrefix) {\n\t\treturn nil, fmt.Errorf(\"weixin: not a weixin session key\")\n\t}\n\tpeer := strings.TrimPrefix(sessionKey, sessionKeyPrefix)\n\ttok := p.getContextToken(peer)\n\tif tok == \"\" {\n\t\treturn nil, fmt.Errorf(\"weixin: no stored context_token for %q (user must message the bot first)\", peer)\n\t}\n\treturn &replyContext{peerUserID: peer, contextToken: tok}, nil\n}\n\n// FormattingInstructions implements core.FormattingInstructionProvider.\nfunc (p *Platform) FormattingInstructions() string {\n\treturn \"Replies are delivered as plain text to Weixin. Avoid markdown tables; use short paragraphs.\"\n}\n\nvar (\n\t_ core.Platform                      = (*Platform)(nil)\n\t_ core.ReplyContextReconstructor     = (*Platform)(nil)\n\t_ core.FormattingInstructionProvider = (*Platform)(nil)","sourceCodeStart":891,"sourceCodeEnd":927,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/weixin/weixin.go#L891-L927","documentation":"ReconstructReplyCtx (used by cron/proactive sends) received a session key that does not start with the weixin sessionKeyPrefix, so it cannot belong to this platform — the key was produced by another platform or is malformed.","triggerScenarios":"Thrown at platform/weixin/weixin.go:909 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Route the reconstruction request to the platform that owns the session key (check the prefix) before calling ReconstructReplyCtx","Verify cron/timer jobs store the full platform-prefixed session key when created"],"exampleFix":null,"handlingStrategy":"validation","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-14T00:17:10.932Z"}