anti patterns – If some value invalid then redo it again considered as antipattern?

        var id = Sessions.FindIndex(x => x.key == req.Cookies(sessionName).Value);
        if (id == -1)
            Sessions.Add(new Session(req.Cookies(sessionName).Value));
        id = Sessions.FindIndex(x => x.key == req.Cookies(sessionName).Value);
        if (id == -1)
            Sessions.Add(new Session(req.Cookies(sessionName).Value));
        Console.WriteLine(id);
        Sessions(id).variables.Add(obj); 

Code is under public domain

Lets say this code in some sort of webserver and there is bug causing session value being different after adding to sessions list
to prevent that adding correct value again, is that considered as antipattern?