AttributeError: 'NoneType' object has no attribute 'paused'

We just upgraded from v8.0 to v10.1.0 yesterday and on some queries(which were working fine previously) we are getting the below error.

Traceback (most recent call last):
File “/usr/local/lib/python3.7/site-packages/flask/”, line 1949, in full_dispatch_request
rv = self.dispatch_request()
File “/usr/local/lib/python3.7/site-packages/flask/”, line 1935, in dispatch_request
return self.view_functionsrule.endpoint
File “/usr/local/lib/python3.7/site-packages/flask_restful/”, line 458, in wrapper
resp = resource(*args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/flask_login/”, line 261, in decorated_view
return func(*args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/flask/”, line 89, in view
return self.dispatch_request(*args, **kwargs)
File “/app/redash/handlers/”, line 33, in dispatch_request
return super(BaseResource, self).dispatch_request(*args, **kwargs)
File “/usr/local/lib/python3.7/site-packages/flask_restful/”, line 573, in dispatch_request
resp = meth(*args, **kwargs)
File “/app/redash/”, line 71, in decorated
return fn(*args, **kwargs)
File “/app/redash/handlers/”, line 311, in post
File “/app/redash/handlers/”, line 66, in run_query
if data_source.paused:
AttributeError: ‘NoneType’ object has no attribute ‘paused’

Could not find any similar errors with other people. I followed the v10.0 upgrade guide and only substituted the image version for the 10.1 upgrade.

What can we do to resolve this?