function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Madeline LittleMadeline Little 

Visualforce Internal Server Error with custom controller

Hello, I've been googling around for the solution to this problem and most of what I'm getting is that there are frequently bugs in salesforce as a whole that causes internal server errors, but I wanted to ask if it was a problem with my code before I give up on this solution.  The error message is below: 

An error message reading "An internal server error has occurred An error has occurred while processing your request. The salesforce.com support team has been notified of the problem. If you believe you have additional information that may be of help in reproducing or correcting the error, please contact Salesforce Support. Please indicate the URL of the page you were requesting, any error id shown on this page as well as any other related information. We apologize for the inconvenience.   Thank you again for your patience and assistance. And thanks for using salesforce.com!   Error ID: 614678235-911289 (-1299140583)"

I'm currently trying to code a visualforce page with a button that will execute some code and display the output in a table.  Here is the controller: 
 
public class GuideAssign {
    //define variables
    public Guide_n__c[] guides;
    public Tour__c[] tours { get; set; }
    public Tour__c[] toursForDisplay { get; set; }
    public Availability__c[] assignavails; 
    public Tour__c ticket;
    public Integer needed;
    public Integer rand;
    //private boolean busseason;    

    //determine season from day
    
    public void assignTours(){
        //do more tickets need to be assigned? 
        needed = tours.size();
        if(needed > 0){
        //if yes
            for(Integer i = 0; i < tours.size(); i++){
            //determine if ticket is for today
            	ticket = tours[i]; 
                //if yes
                if(ticket.Event_Date__c == date.today()){                
                	//get guides with no assignments during that time slot and whose assignments end before and start after that time slot by the overlap amount
                    assignavails = [SELECT A_Date__c,Guide__c,Time_End__c,Time_Start__c FROM Availability__c WHERE A_Date__c = :ticket.Event_Date__c AND Time_Start__c > :ticket.Event_Time__c AND RandAlgoData__c = :true];
                    //randomly select a guide
                    rand = Math.mod(Math.round(Math.random()*1000), needed);
                    //assign the guide to a ticket
                    ticket.Guide__c = assignavails.get(rand).Guide__c;
                    //send the guide and the office a notification and email
                }else{
                //else
                    //get guides with no assignments during that time slot and whose assignments end before and start after that time slot by the overlap amount
                    assignavails = [SELECT A_Date__c,Guide__c,Time_End__c,Time_Start__c FROM Availability__c WHERE A_Date__c = :ticket.Event_Date__c AND Time_Start__c > :ticket.Event_Time__c AND RandAlgoData__c = :true];
                    //randomly select a guide
                    rand = Math.mod(Math.round(Math.random()*1000), needed);
                    //assign the guide to a ticket
                    ticket.Guide__c = assignavails.get(rand).Guide__c;
                }
            	//reset variables
                needed = needed - 1; 
                assignavails = null; 
                rand = null; 
            }
        
        }    
    }
    
    public GuideAssign(){
        tours = [SELECT Duration__c,Event_Date__c,Event_Time__c,Guide__c FROM Tour__c WHERE Guide__c = null];
        toursForDisplay = [SELECT Duration__c,Event_Date__c,Event_Time__c,Guide__c FROM Tour__c WHERE Guide__c = :null LIMIT 500];
        //guides = [SELECT Name,LBG__c,LBG_Licence_Type__c,LBG_Max_Daily_Resvs__c,LBG_Max_Overlap__c,LBG_Min_Overlap__c,LBG_Reservation_Type__c FROM Guide_n__c];
        //assignTours();
        
    }

}
And the visualforce page:
<apex:page controller="GuideAssign">
    
    <apex:pageBlock>
        <apex:pageBlockSection>
            <apex:form>
                <!--<apex:commandButton action="{!assignTours}"/>-->
            </apex:form>
        </apex:pageBlockSection>
        <apex:pageBlockTable value="{!toursForDisplay}" var="t">
        	<apex:column value="{!t.Event_Date__c}"/>
            <apex:column value="{!t.Event_Time__c}"/>
            <apex:column value="{!t.Duration__c}"/>
            <apex:column value="{!t.Guide__c}"/>
        </apex:pageBlockTable>
    </apex:pageBlock>
    
</apex:page>

I've had to comment some things out to prevent compiletime errors from cropping up, but again, I'm not sure if the internal server error is a runtime error or a salesforce bug.  I've been removing or commented out pieces of code in an attempt to fix the error, but nothing has worked yet.  Is there anything glaringly wrong with this? Thanks.