{"record":{"id":"97c202d8b52e8104","repo":"flipped-aurora/gin-vue-admin","slug":"id-w","errorCode":null,"errorMessage":"获取成员ID列表失败: %w","messagePattern":"获取成员ID列表失败: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"server/mcp/org_member_query.go","lineNumber":103,"sourceCode":"\t}\n\n\tvar endpoint, idParam string\n\tswitch dimension {\n\tcase \"department\":\n\t\tendpoint, idParam = \"/department/getDepartmentUsers\", \"deptId\"\n\tcase \"position\":\n\t\tendpoint, idParam = \"/position/getPositionUsers\", \"positionId\"\n\tcase \"authority\":\n\t\tendpoint, idParam = \"/authority/getUsersByAuthority\", \"authorityId\"\n\tdefault:\n\t\treturn nil, errors.New(\"dimension 仅支持 department|position|authority\")\n\t}\n\n\tquery := url.Values{}\n\tquery.Set(idParam, strconv.FormatUint(uint64(targetID), 10))\n\tidsResp, err := getUpstream[[]uint](ctx, endpoint, query)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"获取成员ID列表失败: %w\", err)\n\t}\n\tmemberIDs := idsResp.Data\n\n\tresult := orgMemberResponse{\n\t\tSuccess:     true,\n\t\tMessage:     fmt.Sprintf(\"共 %d 名成员\", len(memberIDs)),\n\t\tDimension:   dimension,\n\t\tTargetID:    targetID,\n\t\tMemberCount: len(memberIDs),\n\t\tMemberIDs:   memberIDs,\n\t}\n\n\tif withUserInfo && len(memberIDs) > 0 {\n\t\tfound, unresolved, err := scanUsersByIDs(ctx, memberIDs)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tfor _, id := range memberIDs {","sourceCodeStart":85,"sourceCodeEnd":121,"githubUrl":"https://github.com/flipped-aurora/gin-vue-admin/blob/3136500ef380842b0eb6c4daa87c3f8a47fcf9e0/server/mcp/org_member_query.go#L85-L121","documentation":"Wrap of an upstream error from a GET request that resolves the member ID list for a dept or position (getUpstream on the configured endpoint). If the backend cannot return the []uint member IDs, the query tool aborts with this message.","triggerScenarios":"Handle queries members by deptId or positionId; getUpstream fails due to network error, 4xx/5xx response, or malformed payload that cannot be decoded into []uint.","commonSituations":"Backend down; wrong dept/position ID causing 4xx; auth token missing; API shape changed so JSON no longer decodes as an array of uints.","solutions":["Check the wrapped cause for status code and body","Confirm the deptId/positionId exists before querying","Verify the admin backend is running and the MCP server can reach it","If decode errors appear, check whether the upstream API response schema changed"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"if deptID == 0 && positionID == 0 {\n    return errors.New(\"provide a valid deptId or positionId to query members\")\n}","typeGuard":null,"tryCatchPattern":"members, err := query.Handle(ctx, args)\nif err != nil {\n    if isRetryable(err) { // network/5xx from wrapped cause\n        time.Sleep(backoff)\n        members, err = query.Handle(ctx, args)\n    }\n    if err != nil {\n        return fmt.Errorf(\"member query failed: %w\", err)\n    }\n}","preventionTips":["Verify dept/position IDs exist before querying membership","Monitor admin backend availability; alert on repeated upstream failures","Watch for upstream API schema changes if decode errors appear"],"tags":["network","upstream-api","query"],"backgroundTag":"upstream-api-call-failed","analyzedSha":"3136500ef380842b0eb6c4daa87c3f8a47fcf9e0","analyzedAt":"2026-08-31T13:50:02.721Z","schemaVersion":2},"datasetVersion":"2026-08-31T19:17:28.585Z"}