Error on import cases from excel

I have been trying to close cases using the page ‘import cases from excel’ and I am facing an error.

This functionality used to work a week ago but not now. How can I fix this?

It's odd that there aren't any details describing the errors - I'd guess this is an infrastructure problem rather than an issue with the upload itself. This feature uses celery to process the uploads asynchronously.

I'd ensure celery is running and check the logs for error messages. You can find more information about that here:
https://dimagi.github.io/commcare-cloud/firefighting/celery.html

1 Like

@Ethan_Soergel , Thank You Very Much for the reply ,
Here is the celery log for corehq.apps.case_importer.tasks.bulk_import_async

Traceback (most recent call last): File "/home/cchq/www/echis/releases/2019-09-11_23.48/python_env-3.6/lib/python3.6/site-packages/celery/app/trace.py", line 375, in trace_task R = retval = fun(*args, **kwargs) File "/home/cchq/www/echis/releases/2019-09-11_23.48/python_env-3.6/lib/python3.6/site-packages/celery/app/trace.py", line 632, in __protected_call__ return self.run(*args, **kwargs) File "/home/cchq/www/echis/releases/2019-09-11_23.48/python_env-3.6/lib/python3.6/site-packages/sentry_sdk/integrations/celery.py", line 138, in _inner reraise(*exc_info) File "/home/cchq/www/echis/releases/2019-09-11_23.48/python_env-3.6/lib/python3.6/site-packages/sentry_sdk/_compat.py", line 54, in reraise raise value File "/home/cchq/www/echis/releases/2019-09-11_23.48/python_env-3.6/lib/python3.6/site-packages/sentry_sdk/integrations/celery.py", line 133, in _inner return f(*args, **kwargs) File "/home/cchq/www/echis/releases/2019-09-11_23.48/corehq/apps/case_importer/tasks.py", line 25, in bulk_import_async case_upload.check_file() File "/home/cchq/www/echis/releases/2019-09-11_23.48/corehq/apps/case_importer/tracking/case_upload_tracker.py", line 51, in check_file open_spreadsheet_download_ref(tempfile) File "/home/cchq/www/echis/releases/2019-09-11_23.48/corehq/apps/case_importer/util.py", line 174, in open_spreadsheet_download_ref with get_spreadsheet(filename): File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__ return next(self.gen) File "/home/cchq/www/echis/releases/2019-09-11_23.48/corehq/apps/case_importer/util.py", line 181, in get_spreadsheet with open_any_workbook(filename) as workbook: File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__ return next(self.gen) File "/home/cchq/www/echis/releases/2019-09-11_23.48/corehq/util/workbook_reading/adapters/generic.py", line 13, in open_any_workbook with open_xlsx_workbook(filename) as workbook: File "/usr/lib/python3.6/contextlib.py", line 81, in __enter__ return next(self.gen) File "/home/cchq/www/echis/releases/2019-09-11_23.48/corehq/util/workbook_reading/adapters/xlsx.py", line 31, in open_xlsx_workbook openpyxl_workbook = openpyxl.load_workbook(f, read_only=True, data_only=True) File "/home/cchq/www/echis/releases/2019-09-11_23.48/python_env-3.6/lib/python3.6/site-packages/openpyxl/reader/excel.py", line 311, in load_workbook data_only, keep_links) File "/home/cchq/www/echis/releases/2019-09-11_23.48/python_env-3.6/lib/python3.6/site-packages/openpyxl/reader/excel.py", line 126, in __init__ self.archive = _validate_archive(fn) File "/home/cchq/www/echis/releases/2019-09-11_23.48/python_env-3.6/lib/python3.6/site-packages/openpyxl/reader/excel.py", line 98, in _validate_archive archive = ZipFile(filename, 'r') File "/usr/lib/python3.6/zipfile.py", line 1131, in __init__ self._RealGetContents() File "/usr/lib/python3.6/zipfile.py", line 1216, in _RealGetContents fp.seek(self.start_dir, 0) OSError: [Errno 22] Invalid argument

It looks like the task is unable to open that file. Is it for sure a valid xlsx file? You might also try uploading a different file, such as one which has worked in the past, which would help identify the issue.