Error: Unable to successfully call PETSc function 'MatSetValuesLocal'. *** Reason: PETSc error code is: 63 (Argument out of range)

I am trying to solve Transient Heat equation on a 2D rectangle. I am a new user of fenics so the solution to my issue might be trivial. I am attaching my code below.
"
from dolfin import *
from mshr import *
import matplotlib.pyplot as plt
import numpy as np
#matplotlib notebook

L, H = 5, 0.3
#cV = Constant(910e-6)*rho
k = Constant(237e-6)
dt = Constant(0.)
mesh = RectangleMesh(Point(0., 0.), Point(L, H), 100, 10, “crossed”)

def lateral_sides(x, on_boundary):
return (near(x[0], 0) or near(x[0], L)) and on_boundary
def bottom(x, on_boundary):
return near(x[1], 0) and on_boundary
def top(x, on_boundary):
return near(x[1], H) and on_boundary

VT = FunctionSpace(mesh, “CG”, 1)
dT = Function(VT)
T_ = TestFunction(VT)
T_old = Function(VT)
Delta_T = Function(VT, name=“Temperature increase”)
#aT = ((dT-T_old)/dtT_ - dot(grad(dT), grad(T_)))dx
res = ((dT-T_old)/dt
T_ - dot(k
grad(dT), grad(T_)))dx
#(cV
(dTheta-Theta_old)/dtTheta_ + dot(kgrad(dTheta), grad(Theta_)))*dx #- Constant(50)*Theta_*dx

#LT = Constant(50)*T_dx
#form = ((dT-T_old)/dt
T_ - dot(grad(dT), grad(T_)))*dx

bcT = [DirichletBC(VT, Constant(500.), bottom),
DirichletBC(VT, Constant(0.), top),
DirichletBC(VT, Constant(0.), lateral_sides)]
#solve(aT == LT, Delta_T, bcT)

Nincr = 10
t = np.logspace(1, 4, Nincr+1)
Nx = 100
x = np.linspace(H, L, Nx)
T_res = np.zeros((Nx, Nincr+1))
T = Function(VT)
for (i, dti) in enumerate(np.diff(t)):
print("Increment`nln " + str(i+1))
dt.assign(dti)
#solve(aT == LT, T, bcT)
solve(res == 0, T, bcT)
#solve(lhs(form) == rhs(form), T, bcT)
T_old.assign(T)
T_res[:, i+1] = [U(xi, 0.)[2] for xi in x]
print(T_res)
"
I am getting the following error whilst the first iteration:
Error: Unable to successfully call PETSc function ‘MatSetValuesLocal’.
*** Reason: PETSc error code is: 63 (Argument out of range).