AttributeError: 'NoneType' object has no attribute 'strip' Possible source of error: education (app)

AttributeError: ‘NoneType’ object has no attribute ‘strip’
Possible source of error: education (app)

we are getting this error whrn im saving new Student

2023-10-22 06:56:28,659 ERROR frappe New Exception collected in error log
Site: lms
Form Dict: {‘doc’: ‘{“docstatus":0,“doctype”:“Student”,“name”:“new-student-zomkkewugy”,“__islocal”:1,“__unsaved”:1,“owner”:"no@mail.com”,“enabled”:1,“naming_series”:“EDU-STU-.YYYY.-”,“joining_date”:“2023-10-21”,“blood_group”:“”,“country”:“United States”,“first_name”:“test1”}’, ‘action’: ‘Save’, ‘cmd’: ‘frappe.desk.form.save.savedocs’}
2023-10-22 06:58:06,106 ERROR frappe New Exception collected in error log
Site: lms
Form Dict: {‘doc’: ‘{“docstatus":0,“doctype”:“Student”,“name”:“new-student-zomkkewugy”,“__islocal”:1,“__unsaved”:1,“owner”:"no@mail.com”,“enabled”:1,“naming_series”:“EDU-STU-.YYYY.-”,“joining_date”:“2023-10-21”,“blood_group”:“”,“country”:“United States”,“first_name”:“test1”}’, ‘action’: ‘Save’, ‘cmd’: ‘frappe.desk.form.save.savedocs’}
2023-10-22 07:02:02,611 ERROR frappe New Exception collected in error log
Site: lms
Form Dict: {‘doc’: ‘{“docstatus":0,“doctype”:“Student”,“name”:“new-student-kdlyvmhrdk”,“__islocal”:1,“__unsaved”:1,“owner”:"no@mail.com”,“enabled”:1,“naming_series”:“EDU-STU-.YYYY.-”,“joining_date”:“2023-10-21”,“blood_group”:“”,“country”:“United States”,“first_name”:“test”}’, ‘action’: ‘Save’, ‘cmd’: ‘frappe.desk.form.save.savedocs’}

The whole bench log

Exception in thread Thread-1:
Traceback (most recent call last):
File “/usr/lib/python3.10/threading.py”, line 1016, in _bootstrap_inner
self.run()
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/client.py”, line 1799, in run
pubsub.get_message(ignore_subscribe_messages=True, timeout=sleep_time)
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/client.py”, line 1690, in get_message
response = self.parse_response(block=(timeout is None), timeout=timeout)
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/client.py”, line 1542, in parse_response
response = self._execute(conn, try_read)
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/client.py”, line 1518, in _execute
return conn.retry.call_with_retry(
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/retry.py”, line 49, in call_with_retry
fail(error)
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/client.py”, line 1520, in
lambda error: self._disconnect_raise_connect(conn, error),
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/client.py”, line 1507, in _disconnect_raise_connect
raise error
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/retry.py”, line 46, in call_with_retry
return do()
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/client.py”, line 1519, in
lambda: command(*args, **kwargs),
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/client.py”, line 1536, in try_read
if not conn.can_read(timeout=timeout):
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/connection.py”, line 861, in can_read
return self._parser.can_read(timeout)
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/connection.py”, line 444, in can_read
return self.read_from_socket(timeout=timeout, raise_on_timeout=False)
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/connection.py”, line 455, in read_from_socket
raise ConnectionError(SERVER_CLOSED_CONNECTION_ERROR)
redis.exceptions.ConnectionError: Connection closed by server.
Traceback (most recent call last):
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/connection.py”, line 699, in connect
sock = self.retry.call_with_retry(
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/retry.py”, line 46, in call_with_retry
return do()
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/connection.py”, line 700, in
lambda: self._connect(), lambda error: self.disconnect(error)
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/connection.py”, line 1002, in _connect
raise err
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/connection.py”, line 990, in _connect
sock.connect(socket_address)
ConnectionRefusedError: [Errno 111] Connection refused

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File “/usr/lib/python3.10/runpy.py”, line 196, in _run_module_as_main
return _run_code(code, main_globals, None,
File “/usr/lib/python3.10/runpy.py”, line 86, in _run_code
exec(code, run_globals)
File “/home/erp/LMS/apps/frappe/frappe/utils/bench_helper.py”, line 114, in
main()
File “/home/erp/LMS/apps/frappe/frappe/utils/bench_helper.py”, line 20, in main
click.Group(commands=commands)(prog_name=“bench”)
File “/home/erp/LMS/env/lib/python3.10/site-packages/click/core.py”, line 1157, in call
return self.main(*args, **kwargs)
File “/home/erp/LMS/env/lib/python3.10/site-packages/click/core.py”, line 1078, in main
rv = self.invoke(ctx)
File “/home/erp/LMS/env/lib/python3.10/site-packages/click/core.py”, line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erp/LMS/env/lib/python3.10/site-packages/click/core.py”, line 1688, in invoke
return _process_result(sub_ctx.command.invoke(sub_ctx))
File “/home/erp/LMS/env/lib/python3.10/site-packages/click/core.py”, line 1434, in invoke
return ctx.invoke(self.callback, **ctx.params)
File “/home/erp/LMS/env/lib/python3.10/site-packages/click/core.py”, line 783, in invoke
return __callback(*args, **kwargs)
File “/home/erp/LMS/apps/frappe/frappe/commands/scheduler.py”, line 208, in start_worker
start_worker(
File “/home/erp/LMS/apps/frappe/frappe/utils/background_jobs.py”, line 281, in start_worker
worker.work(
File “/home/erp/LMS/env/lib/python3.10/site-packages/rq/worker.py”, line 456, in work
self.teardown()
File “/home/erp/LMS/env/lib/python3.10/site-packages/rq/worker.py”, line 1047, in teardown
self.unsubscribe()
File “/home/erp/LMS/env/lib/python3.10/site-packages/rq/worker.py”, line 624, in unsubscribe
self.pubsub.unsubscribe()
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/client.py”, line 1659, in unsubscribe
return self.execute_command(“UNSUBSCRIBE”, *args)
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/client.py”, line 1479, in execute_command
self._execute(connection, connection.send_command, *args, **kwargs)
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/client.py”, line 1518, in _execute
return conn.retry.call_with_retry(
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/retry.py”, line 49, in call_with_retry
fail(error)
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/client.py”, line 1520, in
lambda error: self._disconnect_raise_connect(conn, error),
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/client.py”, line 1507, in _disconnect_raise_connect
raise error
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/retry.py”, line 46, in call_with_retry
return do()
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/client.py”, line 1519, in
lambda: command(*args, **kwargs),
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/connection.py”, line 847, in send_command
self.send_packed_command(
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/connection.py”, line 817, in send_packed_command
self.connect()
File “/home/erp/LMS/env/lib/python3.10/site-packages/redis/connection.py”, line 705, in connect
raise ConnectionError(self._error_message(e))
redis.exceptions.ConnectionError: Error 111 connecting to localhost:11002. Connection refused.
/home/erp/LMS/env/lib/python3.10/site-packages/rq/connections.py:58: DeprecationWarning: The push_connection function is deprecated. Pass the connection explicitly instead.
warnings.warn(
/home/erp/LMS/env/lib/python3.10/site-packages/rq/connections.py:72: DeprecationWarning: The pop_connection function is deprecated. Pass the connection explicitly instead.
warnings.warn(
/home/erp/LMS/env/lib/python3.10/site-packages/rq/connections.py:58: DeprecationWarning: The push_connection function is deprecated. Pass the connection explicitly instead.
warnings.warn(
/home/erp/LMS/env/lib/python3.10/site-packages/rq/connections.py:72: DeprecationWarning: The pop_connection function is deprecated. Pass the connection explicitly instead.
warnings.warn(
/home/erp/LMS/env/lib/python3.10/site-packages/rq/connections.py:58: DeprecationWarning: The push_connection function is deprecated. Pass the connection explicitly instead.
warnings.warn(
/home/erp/LMS/env/lib/python3.10/site-packages/rq/connections.py:72: DeprecationWarning: The pop_connection function is deprecated. Pass the connection explicitly instead.
warnings.warn(
/home/erp/LMS/env/lib/python3.10/site-packages/rq/connections.py:58: DeprecationWarning: The push_connection function is deprecated. Pass the connection explicitly instead.
warnings.warn(
/home/erp/LMS/env/lib/python3.10/site-packages/rq/connections.py:72: DeprecationWarning: The pop_connection function is deprecated. Pass the connection explicitly instead.
warnings.warn(
/home/erp/LMS/env/lib/python3.10/site-packages/rq/connections.py:58: DeprecationWarning: The push_connection function is deprecated. Pass the connection explicitly instead.
warnings.warn(
/home/erp/LMS/env/lib/python3.10/site-packages/rq/connections.py:72: DeprecationWarning: The pop_connection function is deprecated. Pass the connection explicitly instead.
warnings.warn(

App Versions

{
	"education": "0.0.1",
	"erpnext": "15.0.0-dev",
	"frappe": "15.0.0-dev",
	"lms": "1.0.0"
}

Route

Form/Student/new-student-kdlyvmhrdk

Traceback

Traceback (most recent call last):
  File "apps/frappe/frappe/app.py", line 110, in application
    response = frappe.api.handle(request)
  File "apps/frappe/frappe/api/__init__.py", line 49, in handle
    data = endpoint(**arguments)
  File "apps/frappe/frappe/api/v1.py", line 36, in handle_rpc_call
    return frappe.handler.handle()
  File "apps/frappe/frappe/handler.py", line 49, in handle
    data = execute_cmd(cmd)
  File "apps/frappe/frappe/handler.py", line 85, in execute_cmd
    return frappe.call(method, **frappe.form_dict)
  File "apps/frappe/frappe/__init__.py", line 1682, in call
    return fn(*args, **newargs)
  File "apps/frappe/frappe/utils/typing_validations.py", line 31, in wrapper
    return func(*args, **kwargs)
  File "apps/frappe/frappe/desk/form/save.py", line 39, in savedocs
    doc.save()
  File "apps/frappe/frappe/model/document.py", line 334, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 356, in _save
    return self.insert()
  File "apps/frappe/frappe/model/document.py", line 286, in insert
    self.run_before_save_methods()
  File "apps/frappe/frappe/model/document.py", line 1081, in run_before_save_methods
    self.run_method("validate")
  File "apps/frappe/frappe/model/document.py", line 950, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1316, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1298, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 947, in fn
    return method_object(*args, **kwargs)
  File "apps/education/education/education/doctype/student/student.py", line 19, in validate
    self.validate_user()
  File "apps/education/education/education/doctype/student/student.py", line 68, in validate_user
    student_user.add_roles("Student")
  File "apps/frappe/frappe/core/doctype/user/user.py", line 603, in add_roles
    self.save()
  File "apps/frappe/frappe/model/document.py", line 334, in save
    return self._save(*args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 356, in _save
    return self.insert()
  File "apps/frappe/frappe/model/document.py", line 281, in insert
    self.set_new_name(set_name=set_name, set_child_names=set_child_names)
  File "apps/frappe/frappe/model/document.py", line 476, in set_new_name
    set_new_name(self)
  File "apps/frappe/frappe/model/naming.py", line 163, in set_new_name
    doc.run_method("autoname")
  File "apps/frappe/frappe/model/document.py", line 950, in run_method
    out = Document.hook(fn)(self, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1316, in composer
    return composed(self, method, *args, **kwargs)
  File "apps/frappe/frappe/model/document.py", line 1298, in runner
    add_to_return_value(self, fn(self, *args, **kwargs))
  File "apps/frappe/frappe/model/document.py", line 947, in fn
    return method_object(*args, **kwargs)
  File "apps/frappe/frappe/core/doctype/user/user.py", line 125, in autoname
    self.email = self.email.strip().lower()
AttributeError: 'NoneType' object has no attribute 'strip'

Request Data

{
	"type": "POST",
	"args": {
		"doc": "{\"docstatus\":0,\"doctype\":\"Student\",\"name\":\"new-student-zomkkewugy\",\"__islocal\":1,\"__unsaved\":1,\"owner\":\"no@mail.com\",\"enabled\":1,\"naming_series\":\"EDU-STU-.YYYY.-\",\"joining_date\":\"2023-10-21\",\"blood_group\":\"\",\"country\":\"United States\",\"first_name\":\"test1\"}",
		"action": "Save"
	},
	"btn": {
		"jQuery370089577275395390021": {
			"events": {
				"click": [
					{
						"type": "click",
						"origType": "click",
						"guid": 7948,
						"namespace": ""
					}
				]
			}
		}
	},
	"freeze": true,
	"headers": {},
	"error_handlers": {},
	"url": "/api/method/frappe.desk.form.save.savedocs",
	"request_id": null
}

Response Data

{
	"exception": "AttributeError: 'NoneType' object has no attribute 'strip'",
	"exc_type": "AttributeError",
	"_exc_source": "education (app)"
}