{"record":{"id":"08c65bec123eb051","repo":"AlistGo/alist","slug":"failed-to-get-admin-user-w","errorCode":null,"errorMessage":"failed to get admin user: %w","messagePattern":"failed to get admin user: %w","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"server/mcp/auth.go","lineNumber":164,"sourceCode":"\t\treturn fmt.Errorf(\"permission denied for this operation\")\n\t}\n\treturn nil\n}\n\n// UserContextFunc returns an HTTPContextFunc that injects a specific user (for STDIO mode).\nfunc userContextMiddleware(user *model.User) func(ctx context.Context) context.Context {\n\treturn func(ctx context.Context) context.Context {\n\t\treturn context.WithValue(ctx, userKey, user)\n\t}\n}\n\n// resolveUserForStdio resolves a user by username for STDIO mode.\nfunc resolveUserForStdio(username string) (*model.User, error) {\n\tusername = strings.TrimSpace(username)\n\tif username == \"\" || username == \"admin\" {\n\t\tadmin, err := op.GetAdmin()\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"failed to get admin user: %w\", err)\n\t\t}\n\t\tif err := loadRoles(admin); err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\treturn admin, nil\n\t}\n\tuser, err := op.GetUserByName(username)\n\tif err != nil {\n\t\treturn nil, fmt.Errorf(\"user %q not found: %w\", username, err)\n\t}\n\tif user.Disabled {\n\t\treturn nil, fmt.Errorf(\"user %q is disabled\", username)\n\t}\n\tif err := loadRoles(user); err != nil {\n\t\treturn nil, err\n\t}\n\treturn user, nil\n}","sourceCodeStart":146,"sourceCodeEnd":182,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/server/mcp/auth.go#L146-L182","documentation":"Error \"failed to get admin user: %w\" thrown in AlistGo/alist.","triggerScenarios":"Thrown at server/mcp/auth.go:164 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the underlying error details in the message, fix the indicated cause (credentials, network, or provider-side failure), and retry."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}