{"record":{"id":"d4e78cfa8ef57fa2","repo":"chenhg5/cc-connect","slug":"api-call-w","errorCode":null,"errorMessage":"api call: %w","messagePattern":"api call: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"platform/feishu/feishu.go","lineNumber":3815,"sourceCode":"func findSingleAsterisk(s string) int {\n\tfor i := 0; i < len(s); i++ {\n\t\tif s[i] == '*' {\n\t\t\tif i+1 < len(s) && s[i+1] == '*' {\n\t\t\t\ti++ // skip **\n\t\t\t\tcontinue\n\t\t\t}\n\t\t\treturn i\n\t\t}\n\t}\n\treturn -1\n}\n\n// fetchBotOpenID retrieves the bot's open_id via the Feishu bot info API.\nfunc (p *Platform) fetchBotOpenID() (string, error) {\n\tresp, err := p.client.Get(context.Background(),\n\t\t\"/open-apis/bot/v3/info\", nil, larkcore.AccessTokenTypeTenant)\n\tif err != nil {\n\t\treturn \"\", fmt.Errorf(\"api call: %w\", err)\n\t}\n\tvar result struct {\n\t\tCode int `json:\"code\"`\n\t\tBot  struct {\n\t\t\tOpenID string `json:\"open_id\"`\n\t\t} `json:\"bot\"`\n\t}\n\tif err := json.Unmarshal(resp.RawBody, &result); err != nil {\n\t\treturn \"\", fmt.Errorf(\"parse response: %w\", err)\n\t}\n\tif result.Code != 0 {\n\t\treturn \"\", fmt.Errorf(\"api code=%d\", result.Code)\n\t}\n\treturn result.Bot.OpenID, nil\n}\n\nfunc isBotMentioned(mentions []*larkim.MentionEvent, botOpenID string) bool {\n\tfor _, m := range mentions {","sourceCodeStart":3797,"sourceCodeEnd":3833,"githubUrl":"https://github.com/chenhg5/cc-connect/blob/4000b2338aa6e850c99df54f8b0ed6ed7460b401/platform/feishu/feishu.go#L3797-L3833","documentation":"Wraps a transport error from the raw SDK call p.client.Get(\"/open-apis/bot/v3/info\") used by fetchBotOpenID to discover the bot's open_id. Thrown when the HTTP request to the Feishu bot-info API fails before a response can be parsed (network error, auth failure, client misconfiguration).","triggerScenarios":"p.client.Get(context.Background(), \"/open-apis/bot/v3/info\", nil, larkcore.AccessTokenTypeTenant) returns err at platform/feishu/feishu.go:3815 — DNS/proxy failure, invalid tenant_access_token acquisition, or nil p.client during startup ordering issues.","commonSituations":"Platform starting before the lark client is fully initialized; wrong domain (feishu vs Lark) configured so the endpoint doesn't resolve; invalid app credentials; corporate firewall blocking open.feishu.cn.","solutions":["Inspect the wrapped error for the exact transport cause.","Verify app_id/app_secret and that the correct API domain (.cn vs larksuite) is configured.","Ensure the lark client is created before fetchBotOpenID runs (check startup ordering).","Check host network/proxy access to the Feishu open API."],"exampleFix":null,"handlingStrategy":"fallback","validationCode":"if p.client == nil {\n    return errors.New(\"feishu: lark client not initialized before fetchBotOpenID\")\n}","typeGuard":null,"tryCatchPattern":"openID, err := p.fetchBotOpenID()\nif err != nil {\n    slog.Warn(\"feishu: bot open_id unavailable, continuing without it\", \"err\", err)\n    openID = \"\" // degrade gracefully where open_id is optional\n}","preventionTips":["Initialize the lark client before any bot-info API calls at startup.","Configure the correct API domain for your region (feishu.cn vs larksuite.com).","Treat bot open_id as optional metadata and degrade gracefully when unavailable.","Run connectivity checks (cc-connect doctor) before going live."],"tags":["feishu","api","network","bot-info"],"backgroundTag":"api-request-failed","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"}