Hello, 

I get the error below during backtests. In my case it raises close to the end of the backtest. I tried searching the documents for the meaning of this, google searches wrt to quant connect, debugging to see why this occurs etc to no avail. 

Would anyone be able to tell me the nature of this keyerror, or perhaps reasons for it ?

Any info would be helpful, thank you in advance.

Runtime Error: Trying to retrieve an element from a collection using a key that does not exist in that collection throws a KeyError exception. To prevent the exception, ensure that the key exist in the collection and/or that collection is not empty.
  at OnSecuritiesChanged
    self.activeStocks.remove(x.Symbol)
   at Python.Runtime.PythonException.ThrowLastAsClrException()
   at Python.Runtime.PyObject.Invoke(PyTuple args in main.py: line 106 (Open Stack Trace)