Try ERPNext Buy Support Partners Foundation

Creating new customer having error of redis server how to fix?

hi
when i have create a new customer and save it after click on save below error occur.how to fix this

Server Error

redis.exceptions.DataError: Invalid input of type: ‘NoneType’. Convert to a byte, string or number first.

How to fix this need help

Thanks

Same issue here, below is my log

16:46:51 web.1            | Traceback (most recent call last):
16:46:51 web.1            |   File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/load.py", line 35, in getdoc
16:46:51 web.1            |     run_onload(doc)
16:46:51 web.1            |   File "/home/frappe/frappe-bench/apps/frappe/frappe/desk/form/load.py", line 247, in run_onload
16:46:51 web.1            |     doc.run_method("onload")
16:46:51 web.1            |   File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 794, in run_method
16:46:51 web.1            |     out = Document.hook(fn)(self, *args, **kwargs)
16:46:51 web.1            |   File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1065, in composer
16:46:51 web.1            |     return composed(self, method, *args, **kwargs)
16:46:51 web.1            |   File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 1048, in runner
16:46:51 web.1            |     add_to_return_value(self, fn(self, *args, **kwargs))
16:46:51 web.1            |   File "/home/frappe/frappe-bench/apps/frappe/frappe/model/document.py", line 788, in <lambda>
16:46:51 web.1            |     fn = lambda self, *args, **kwargs: getattr(self, method)(*args, **kwargs)
16:46:51 web.1            |   File "/home/frappe/frappe-bench/apps/erpnext/erpnext/selling/doctype/customer/customer.py", line 24, in onload
16:46:51 web.1            |     self.load_dashboard_info()
16:46:51 web.1            |   File "/home/frappe/frappe-bench/apps/erpnext/erpnext/selling/doctype/customer/customer.py", line 27, in load_dashboard_info
16:46:51 web.1            |     info = get_dashboard_info(self.doctype, self.name, self.loyalty_program)
16:46:51 web.1            |   File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/party.py", line 500, in get_dashboard_info
16:46:51 web.1            |     current_fiscal_year = get_fiscal_year(nowdate(), as_dict=True)
16:46:51 web.1            |   File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/utils.py", line 24, in get_fiscal_year
16:46:51 web.1            |     return get_fiscal_years(date, fiscal_year, label, verbose, company, as_dict=as_dict)[0]
16:46:51 web.1            |   File "/home/frappe/frappe-bench/apps/erpnext/erpnext/accounts/utils.py", line 27, in get_fiscal_years
16:46:51 web.1            |     fiscal_years = frappe.cache().hget("fiscal_years", company) or []
16:46:51 web.1            |   File "/home/frappe/frappe-bench/apps/frappe/frappe/utils/redis_wrapper.py", line 172, in hget
16:46:51 web.1            |     value = super(RedisWrapper, self).hget(_name, key)
16:46:51 web.1            |   File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/redis/client.py", line 2975, in hget
16:46:51 web.1            |     return self.execute_command('HGET', name, key)
16:46:51 web.1            |   File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/redis/client.py", line 877, in execute_command
16:46:51 web.1            |     conn.send_command(*args)
16:46:51 web.1            |   File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/redis/connection.py", line 720, in send_command
16:46:51 web.1            |     self.send_packed_command(self.pack_command(*args),
16:46:51 web.1            |   File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/redis/connection.py", line 771, in pack_command
16:46:51 web.1            |     for arg in imap(self.encoder.encode, args):
16:46:51 web.1            |   File "/home/frappe/frappe-bench/env/lib/python3.5/site-packages/redis/connection.py", line 121, in encode
16:46:51 web.1            |     "bytes, string, int or float first." % typename)
16:46:51 web.1            | redis.exceptions.DataError: Invalid input of type: 'NoneType'. Convert to a bytes, string, int or float first.

It’s because current_fiscal_year = get_fiscal_year(nowdate(), as_dict=True) which get_fiscal_year been called without company parameter.
My ERPNext version is v12.5.0

I think frappe/utils/redis_wrapper.py missing the conditionif not key: return None in functions hget and hset.

1 Like

@satish_malkar @SDLyu do bench update & bench build it will work

1 Like

If i put if not key: return None i have an Internal Server Error

My bad… this bug is solved in develop branch here.