What do you do when you cannot make progress on the problem you have been working on? I am a 2nd year graduate student in theory.
I have been working on a problem for the last year (in graph theory/algorithms).
Until yesterday I thought I am doing well (I was extending a theorem from a paper).
Today I realized that I have made a simple mistake. 
I realized that it will be much harder than I thought to do what I intended to do. 
I feel disappointed so much I am thinking about leaving grad school.

Is this a common situation that a researchers notices that her idea is not going to work after considerable amount of work?

What do you do when you realized that an approach you had in mind is not going to work and
the problem seems too difficult to solve?

What advice would you give to a student in my situation?
Is this a common situation that a researchers notices that her idea is
  not going to work after considerable amount of work?


Yes. But as you get more experienced, you're able to "fail fast" - learn how to test the idea quickly to see if it passes a 'smell test'. 


  What do you do when you realized that an approach you had in mind is
  not going to work and the problem seems too difficult to solve?


It depends. Sometimes the best thing to do is put the problem away for a while and work on something else. Sometimes the failure suggests a different question. 


  What advice would you give to a student in my situation?