AlistGo/alist · error

failed to get admin user: %w

Error message

failed to get admin user: %w

What it means

Error "failed to get admin user: %w" thrown in AlistGo/alist.

Source

Thrown at server/mcp/auth.go:164

		return fmt.Errorf("permission denied for this operation")
	}
	return nil
}

// UserContextFunc returns an HTTPContextFunc that injects a specific user (for STDIO mode).
func userContextMiddleware(user *model.User) func(ctx context.Context) context.Context {
	return func(ctx context.Context) context.Context {
		return context.WithValue(ctx, userKey, user)
	}
}

// resolveUserForStdio resolves a user by username for STDIO mode.
func resolveUserForStdio(username string) (*model.User, error) {
	username = strings.TrimSpace(username)
	if username == "" || username == "admin" {
		admin, err := op.GetAdmin()
		if err != nil {
			return nil, fmt.Errorf("failed to get admin user: %w", err)
		}
		if err := loadRoles(admin); err != nil {
			return nil, err
		}
		return admin, nil
	}
	user, err := op.GetUserByName(username)
	if err != nil {
		return nil, fmt.Errorf("user %q not found: %w", username, err)
	}
	if user.Disabled {
		return nil, fmt.Errorf("user %q is disabled", username)
	}
	if err := loadRoles(user); err != nil {
		return nil, err
	}
	return user, nil
}

View on GitHub (pinned to 843d9dc814)

Solutions

  1. Inspect the underlying error details in the message, fix the indicated cause (credentials, network, or provider-side failure), and retry.

When it happens

Trigger: Thrown at server/mcp/auth.go:164 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of AlistGo/alist@843d9dc814 (2026-08-15). Data as JSON: /api/errors/08c65bec123eb051. Report an issue: GitHub.