Hi Team,
We are facing error below while deploying the code after change 85 is applied:
TASK [deploy_hq : Migrate databases] *****************************************************************************************************************************
failed: [192.168.1.80] (item=migrate_multi --noinput) => {"ansible_loop_var": "item", "changed": true, "cmd": ["./manage.py", "migrate_multi", "--noinput"], "delta": "0:01:00.365164", "end": "2025-04-03 10:34:49.617263", "item": "migrate_multi --noinput", "msg": "non-zero return code", "rc": 1, "start": "2025-04-03 10:33:49.252099", "stderr": "Traceback (most recent call last):\n File \"src/gevent/greenlet.py\", line 900, in gevent._gevent_cgreenlet.Greenlet.run\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/corehq/sql_db/management/commands/migrate_multi.py\", line 43, in migrate_db\n call_command('migrate', *args, **call_options)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/__init__.py\", line 194, in call_command\n return command.execute(*args, **defaults)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/base.py\", line 458, in execute\n output = self.handle(*args, **options)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/base.py\", line 106, in wrapper\n res = handle_func(*args, **kwargs)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/corehq/sql_db/management/commands/migrate.py\", line 17, in handle\n result = super().handle(*args, **options)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/base.py\", line 106, in wrapper\n res = handle_func(*args, **kwargs)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/commands/migrate.py\", line 356, in handle\n post_migrate_state = executor.migrate(\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/executor.py\", line 135, in migrate\n state = self._migrate_all_forwards(\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/executor.py\", line 167, in _migrate_all_forwards\n state = self.apply_migration(\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/executor.py\", line 252, in apply_migration\n state = migration.apply(state, schema_editor)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/migration.py\", line 132, in apply\n operation.database_forwards(\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/operations/special.py\", line 193, in database_forwards\n self.code(from_state.apps, schema_editor)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/corehq/util/django_migrations.py\", line 121, in _inner\n return migration_fn(*args, **kwargs)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/./corehq/ex-submodules/pillowtop/migrations/0008_sync_es_with_couch_webusers.py\", line 8, in sync_couch_webusers_with_es\n call_command('sync_es_webusers')\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/__init__.py\", line 194, in call_command\n return command.execute(*args, **defaults)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/base.py\", line 458, in execute\n output = self.handle(*args, **options)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/./corehq/ex-submodules/pillowtop/management/commands/sync_es_webusers.py\", line 14, in handle\n update_user_in_es(None, CouchUser.wrap_correctly(user_doc))\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/corehq/apps/users/models.py\", line 1423, in wrap_correctly\n doc_type = source['doc_type']\nTypeError: 'NoneType' object is not subscriptable\n2025-04-03T10:34:23Z <Greenlet at 0x7f518ec3da40: migrate_db('default')> failed with TypeError", "stderr_lines": ["Traceback (most recent call last):", " File \"src/gevent/greenlet.py\", line 900, in gevent._gevent_cgreenlet.Greenlet.run", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/corehq/sql_db/management/commands/migrate_multi.py\", line 43, in migrate_db", " call_command('migrate', *args, **call_options)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/__init__.py\", line 194, in call_command", " return command.execute(*args, **defaults)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/base.py\", line 458, in execute", " output = self.handle(*args, **options)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/base.py\", line 106, in wrapper", " res = handle_func(*args, **kwargs)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/corehq/sql_db/management/commands/migrate.py\", line 17, in handle", " result = super().handle(*args, **options)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/base.py\", line 106, in wrapper", " res = handle_func(*args, **kwargs)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/commands/migrate.py\", line 356, in handle", " post_migrate_state = executor.migrate(", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/executor.py\", line 135, in migrate", " state = self._migrate_all_forwards(", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/executor.py\", line 167, in _migrate_all_forwards", " state = self.apply_migration(", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/executor.py\", line 252, in apply_migration", " state = migration.apply(state, schema_editor)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/migration.py\", line 132, in apply", " operation.database_forwards(", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/operations/special.py\", line 193, in database_forwards", " self.code(from_state.apps, schema_editor)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/corehq/util/django_migrations.py\", line 121, in _inner", " return migration_fn(*args, **kwargs)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/./corehq/ex-submodules/pillowtop/migrations/0008_sync_es_with_couch_webusers.py\", line 8, in sync_couch_webusers_with_es", " call_command('sync_es_webusers')", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/__init__.py\", line 194, in call_command", " return command.execute(*args, **defaults)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/base.py\", line 458, in execute", " output = self.handle(*args, **options)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/./corehq/ex-submodules/pillowtop/management/commands/sync_es_webusers.py\", line 14, in handle", " update_user_in_es(None, CouchUser.wrap_correctly(user_doc))", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/corehq/apps/users/models.py\", line 1423, in wrap_correctly", " doc_type = source['doc_type']", "TypeError: 'NoneType' object is not subscriptable", "2025-04-03T10:34:23Z <Greenlet at 0x7f518ec3da40: migrate_db('default')> failed with TypeError"], "stdout": "\nThe following databases will be migrated:\n * default\n * auditcare\n * p1\n * p2\n * p3\n * p4\n * p5\n * p6\n * p7\n * p8\n * proxy\n * synclogs\n\n\nThe following databases will be skipped:\n * ucr\n\n\n======================= Error During Migration =======================\n<Greenlet at 0x7f518ec3da40: migrate_db('default')>\nTraceback (most recent call last):\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/corehq/sql_db/management/commands/migrate_multi.py\", line 66, in handle\n job.get()\n File \"src/gevent/greenlet.py\", line 797, in gevent._gevent_cgreenlet.Greenlet.get\n File \"src/gevent/greenlet.py\", line 373, in gevent._gevent_cgreenlet.Greenlet._raise_exception\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/gevent/_compat.py\", line 50, in reraise\n raise value.with_traceback(tb)\n File \"src/gevent/greenlet.py\", line 900, in gevent._gevent_cgreenlet.Greenlet.run\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/corehq/sql_db/management/commands/migrate_multi.py\", line 43, in migrate_db\n call_command('migrate', *args, **call_options)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/__init__.py\", line 194, in call_command\n return command.execute(*args, **defaults)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/base.py\", line 458, in execute\n output = self.handle(*args, **options)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/base.py\", line 106, in wrapper\n res = handle_func(*args, **kwargs)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/corehq/sql_db/management/commands/migrate.py\", line 17, in handle\n result = super().handle(*args, **options)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/base.py\", line 106, in wrapper\n res = handle_func(*args, **kwargs)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/commands/migrate.py\", line 356, in handle\n post_migrate_state = executor.migrate(\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/executor.py\", line 135, in migrate\n state = self._migrate_all_forwards(\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/executor.py\", line 167, in _migrate_all_forwards\n state = self.apply_migration(\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/executor.py\", line 252, in apply_migration\n state = migration.apply(state, schema_editor)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/migration.py\", line 132, in apply\n operation.database_forwards(\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/operations/special.py\", line 193, in database_forwards\n self.code(from_state.apps, schema_editor)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/corehq/util/django_migrations.py\", line 121, in _inner\n return migration_fn(*args, **kwargs)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/./corehq/ex-submodules/pillowtop/migrations/0008_sync_es_with_couch_webusers.py\", line 8, in sync_couch_webusers_with_es\n call_command('sync_es_webusers')\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/__init__.py\", line 194, in call_command\n return command.execute(*args, **defaults)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/base.py\", line 458, in execute\n output = self.handle(*args, **options)\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/./corehq/ex-submodules/pillowtop/management/commands/sync_es_webusers.py\", line 14, in handle\n update_user_in_es(None, CouchUser.wrap_correctly(user_doc))\n File \"/home/cchq/www/echis/releases/2025-04-03_10.21/corehq/apps/users/models.py\", line 1423, in wrap_correctly\n doc_type = source['doc_type']\nTypeError: 'NoneType' object is not subscriptable", "stdout_lines": ["", "The following databases will be migrated:", " * default", " * auditcare", " * p1", " * p2", " * p3", " * p4", " * p5", " * p6", " * p7", " * p8", " * proxy", " * synclogs", "", "", "The following databases will be skipped:", " * ucr", "", "", "======================= Error During Migration =======================", "<Greenlet at 0x7f518ec3da40: migrate_db('default')>", "Traceback (most recent call last):", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/corehq/sql_db/management/commands/migrate_multi.py\", line 66, in handle", " job.get()", " File \"src/gevent/greenlet.py\", line 797, in gevent._gevent_cgreenlet.Greenlet.get", " File \"src/gevent/greenlet.py\", line 373, in gevent._gevent_cgreenlet.Greenlet._raise_exception", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/gevent/_compat.py\", line 50, in reraise", " raise value.with_traceback(tb)", " File \"src/gevent/greenlet.py\", line 900, in gevent._gevent_cgreenlet.Greenlet.run", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/corehq/sql_db/management/commands/migrate_multi.py\", line 43, in migrate_db", " call_command('migrate', *args, **call_options)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/__init__.py\", line 194, in call_command", " return command.execute(*args, **defaults)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/base.py\", line 458, in execute", " output = self.handle(*args, **options)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/base.py\", line 106, in wrapper", " res = handle_func(*args, **kwargs)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/corehq/sql_db/management/commands/migrate.py\", line 17, in handle", " result = super().handle(*args, **options)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/base.py\", line 106, in wrapper", " res = handle_func(*args, **kwargs)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/commands/migrate.py\", line 356, in handle", " post_migrate_state = executor.migrate(", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/executor.py\", line 135, in migrate", " state = self._migrate_all_forwards(", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/executor.py\", line 167, in _migrate_all_forwards", " state = self.apply_migration(", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/executor.py\", line 252, in apply_migration", " state = migration.apply(state, schema_editor)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/migration.py\", line 132, in apply", " operation.database_forwards(", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/db/migrations/operations/special.py\", line 193, in database_forwards", " self.code(from_state.apps, schema_editor)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/corehq/util/django_migrations.py\", line 121, in _inner", " return migration_fn(*args, **kwargs)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/./corehq/ex-submodules/pillowtop/migrations/0008_sync_es_with_couch_webusers.py\", line 8, in sync_couch_webusers_with_es", " call_command('sync_es_webusers')", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/__init__.py\", line 194, in call_command", " return command.execute(*args, **defaults)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/python_env/lib/python3.9/site-packages/django/core/management/base.py\", line 458, in execute", " output = self.handle(*args, **options)", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/./corehq/ex-submodules/pillowtop/management/commands/sync_es_webusers.py\", line 14, in handle", " update_user_in_es(None, CouchUser.wrap_correctly(user_doc))", " File \"/home/cchq/www/echis/releases/2025-04-03_10.21/corehq/apps/users/models.py\", line 1423, in wrap_correctly", " doc_type = source['doc_type']", "TypeError: 'NoneType' object is not subscriptable"]}
The following error is also appearing in xfom-pillow log:
Thank you,