{"record":{"id":"be9e171d0e2f47b2","repo":"chenhg5/cc-connect","slug":"s-fetch-tenant-token-for-chat-members-w","errorCode":null,"errorMessage":"%s: fetch tenant token for chat members: %w","messagePattern":"(.+?): fetch tenant token for chat members: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/feishu/feishu.go","lineNumber":2260,"sourceCode":"\tfetchedAt time.Time\n}\n\n// fetchChatMembers retrieves all members of a chat and returns a name->openID map.\nfunc (p *Platform) fetchChatMembers(ctx context.Context, chatID string) (map[string]string, error) {\n\tif p.client == nil {\n\t\treturn nil, fmt.Errorf(\"%s: client not initialized\", p.tag())\n\t}\n\tmembers := make(map[string]string)\n\treq := larkim.NewGetChatMembersReqBuilder().\n\t\tChatId(chatID).\n\t\tMemberIdType(\"open_id\").\n\t\tPageSize(100).\n\t\tBuild()\n\ttimeoutCtx, cancel := context.WithTimeout(ctx, 10*time.Second)\n\tdefer cancel()\n\ttoken, err := p.fetchFreshTenantAccessToken(timeoutCtx)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: fetch tenant token for chat members: %w\", p.tag(), err)\n\t}\n\titer, err := p.client.Im.ChatMembers.GetByIterator(timeoutCtx, req, larkcore.WithTenantAccessToken(token))\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"%s: list chat members: %w\", p.tag(), err)\n\t}\n\tfor {\n\t\thasMore, member, err := iter.Next()\n\t\tif err != nil {\n\t\t\tslog.Debug(p.tag()+\": fetch chat members page error\", \"chat_id\", chatID, \"error\", err)\n\t\t\tbreak\n\t\t}\n\t\tif member != nil && member.Name != nil && member.MemberId != nil {\n\t\t\tname := *member.Name\n\t\t\tif _, exists := members[name]; !exists {\n\t\t\t\tmembers[name] = *member.MemberId\n\t\t\t} else {\n\t\t\t\tmembers[name] = \"\"\n\t\t\t}","sourceCodeStart":2242,"sourceCodeEnd":2278,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/feishu/feishu.go#L2242-L2278","documentation":"fetchChatMembers could not obtain a fresh tenant access token (within its 10s timeout) before listing chat members. Wraps the token-fetch failure; root causes include invalid app credentials or Lark auth service unavailability.","triggerScenarios":"Thrown at platform/feishu/feishu.go:2260 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check app_id/app_secret validity","Check network to open.feishu.cn; the token fetch has its own retry layer"],"exampleFix":null,"handlingStrategy":"retry","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"}