flipped-aurora/gin-vue-admin · error
获取用户列表失败: %w
Error message
获取用户列表失败: %w
What it means
scanUsersByIDs pages through POST /user/getUserList (100 per page, up to 20 pages) looking for target user IDs, since upstream does not support filtering by ID. If any page request fails, the error is wrapped as 获取用户列表失败 and the whole scan aborts.
Source
Thrown at server/mcp/org_common.go:207
return authority, nil
}
// scanUsersByIDs 按ID集合补全用户信息:上游 getUserList 不支持按ID过滤,翻页扫描至集齐或达页数上限,
// 返回 命中映射 与 未解析ID 列表(行级可见范围由主服务侧 datascope 引擎决定)
func scanUsersByIDs(ctx context.Context, ids []uint) (map[uint]system.SysUser, []uint, error) {
want := make(map[uint]struct{}, len(ids))
for _, id := range ids {
want[id] = struct{}{}
}
found := make(map[uint]system.SysUser, len(ids))
for page := 1; page <= orgUserScanMaxPages && len(found) < len(want); page++ {
resp, err := postUpstream[pageResultData[[]system.SysUser]](ctx, "/user/getUserList", map[string]any{
"page": page,
"pageSize": orgUserScanPageSize,
})
if err != nil {
return nil, nil, fmt.Errorf("获取用户列表失败: %w", err)
}
for i := range resp.Data.List {
user := resp.Data.List[i]
if _, ok := want[user.ID]; ok {
found[user.ID] = user
}
}
if len(resp.Data.List) < orgUserScanPageSize {
break
}
}
var unresolved []uint
for _, id := range ids {
if _, ok := found[id]; !ok {
unresolved = append(unresolved, id)
}
}View on GitHub (pinned to 3136500ef3)
Solutions
- Check upstream /user/getUserList health and response codes manually
- Retry the operation (transient network failures)
- Verify the MCP upstream token is valid
- Reduce load/rate or check upstream logs if 5xx occur on large pages
Defensive patterns
Strategy: retry
Validate before calling
// light pre-check: ensure upstream user list endpoint answers
const res = await fetch(baseUrl + '/user/getUserList', { method: 'POST', body: JSON.stringify({ page: 1, pageSize: 1 }) })
if (!res.ok) throw new Error('user list endpoint unavailable') Try / catch
try {
await callMcpTool(tool, args)
} catch (e) {
if (String(e.message).includes('获取用户列表失败')) {
// transient? retry with exponential backoff; else check token/connectivity via e.cause
}
} Prevention
- Pass a username hint to avoid multi-page scans entirely
- Keep tokens fresh; scans amplify the chance of hitting an expired-token failure mid-run
- Monitor upstream latency; timeouts during long scans look like failures
When it happens
Trigger: Any org tool needing user lookups by ID (assign_user_org, findUserByID fallback) while a paginated POST /user/getUserList call fails: network error, token issue, upstream 4xx/5xx, or invalid response envelope.
Common situations: Upstream service briefly down or rate-limiting during multi-page scans; expired MCP upstream token; load balancer timeouts on large user tables.
Related errors
AI-assisted analysis of flipped-aurora/gin-vue-admin@3136500ef3 (2026-08-31).
Data as JSON: /api/errors/ef1aa99f98bdff94.
Report an issue: GitHub.