TypeError: unsupported operand type(s) for |: 'type' and 'NoneType'

Hello Everyone,
I’m facing a problem when updating erpnext bench, Every time i try to update bench keeps on getting this error.

erpnext@erpnext-vm-2:/opt/bench/erpnext$ bench update
WARN: bench is installed in editable mode!

This is not the recommended mode of installation for production. Instead, install the package from PyPI with: pip install frappe-bench

Traceback (most recent call last):
File “/usr/lib/python3.8/runpy.py”, line 185, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File “/usr/lib/python3.8/runpy.py”, line 111, in _get_module_details
import(pkg_name)
File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 25, in
from frappe.query_builder import (
File “/opt/bench/erpnext/apps/frappe/frappe/query_builder/init.py”, line 6, in
from frappe.query_builder.terms import ParameterizedFunction, ParameterizedValueWrapper
File “/opt/bench/erpnext/apps/frappe/frappe/query_builder/terms.py”, line 8, in
from frappe.utils.data import format_timedelta
File “/opt/bench/erpnext/apps/frappe/frappe/utils/init.py”, line 25, in
from frappe.utils.data import *
File “/opt/bench/erpnext/apps/frappe/frappe/utils/data.py”, line 75, in
def getdate(string_date: Optional[“DateTimeLikeObject”] = None) → datetime.date | None:
TypeError: unsupported operand type(s) for |: ‘type’ and ‘NoneType’

Bench command cache doesn’t exist in this folder!
remote: Total 0 (delta 0), reused 0 (delta 0), pack-reused 0
From GitHub - frappe/frappe: Low code web framework for real world applications, in Python and Javascript

  • branch develop → FETCH_HEAD
    WARN: shallow_clone is set in your bench config.
    However without passing the --reset flag, your repositories will be unshallowed.
    To avoid this, cancel this operation and run bench update --reset.

Consider the consequences of git reset --hard on your apps before you run that.
To avoid seeing this warning, set shallow_clone to false in your common_site_config.json

Backing up sites…
Traceback (most recent call last):
File “/usr/lib/python3.8/runpy.py”, line 185, in _run_module_as_main
mod_name, mod_spec, code = _get_module_details(mod_name, _Error)
File “/usr/lib/python3.8/runpy.py”, line 111, in _get_module_details
import(pkg_name)
File “/opt/bench/erpnext/apps/frappe/frappe/init.py”, line 25, in
from frappe.query_builder import (
File “/opt/bench/erpnext/apps/frappe/frappe/query_builder/init.py”, line 6, in
from frappe.query_builder.terms import ParameterizedFunction, ParameterizedValueWrapper
File “/opt/bench/erpnext/apps/frappe/frappe/query_builder/terms.py”, line 8, in
from frappe.utils.data import format_timedelta
File “/opt/bench/erpnext/apps/frappe/frappe/utils/init.py”, line 25, in
from frappe.utils.data import *
File “/opt/bench/erpnext/apps/frappe/frappe/utils/data.py”, line 75, in
def getdate(string_date: Optional[“DateTimeLikeObject”] = None) → datetime.date | None:
TypeError: unsupported operand type(s) for |: ‘type’ and ‘NoneType’

it’s not only with bench update, it also with bench backup, bench migrate
Can i get help