When I try to export a list of users, I receive a notification that “data export failed.” The export does indeed fail but I see no entry in the error logs. I did successfully export a user list on 15 Sep 2020. I don’t suspect a db problem since Data Explorer runs without error. Ideas?
AI-generated summary
sturdy2 reports that exporting a user list fails with a “data export failed” notification, despite no errors appearing in logs. Previously, exports worked (last successful on 15 Sep 2020), and Data Explorer functions normally, ruling out a general database issue. After removing expired invites and rebuilding the app via ./launcher rebuild app, the export still failed—but this time produced an error: undefined method 'email' for nil:NilClass at /app/models/user.rb:1247. The stack trace points to a null user object during batch processing in export_csv_file.rb, suggesting a corrupted or incomplete user record is causing the export to crash. sturdy2 provides the full backtrace for debugging, indicating the failure occurs when attempting to access the email attribute of a nil user object during iteration. This implies a data integrity issue — likely a user record missing required fields — is breaking the export process. No workaround is yet identified, and the error only surfaced after app rebuild, possibly due to updated code paths or stricter validations.
Update to OP.
Today I had a relook at this issue and found many expired invites which I removed. Tried User export again with same result and still no error report. Did a ./launcher rebuild app then tried another User Export which again failed but this time I got an error report. See below:
Info:
Job exception: undefined method `email’ for nil:NilClass
backtrace:
/var/www/discourse/app/models/user.rb:1247:in `email’
/var/www/discourse/app/jobs/regular/export_csv_file.rb:261:in `get_base_user_array'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:128:in `block in user_list_export'
activerecord-6.0.3.3/lib/active_record/relation/batches.rb:70:in `block (2 levels) in find_each'
activerecord-6.0.3.3/lib/active_record/relation/batches.rb:70:in `each'
activerecord-6.0.3.3/lib/active_record/relation/batches.rb:70:in `block in find_each'
activerecord-6.0.3.3/lib/active_record/relation/batches.rb:136:in `block in find_in_batches'
activerecord-6.0.3.3/lib/active_record/relation/batches.rb:238:in `block in in_batches'
activerecord-6.0.3.3/lib/active_record/relation/batches.rb:222:in `loop'
activerecord-6.0.3.3/lib/active_record/relation/batches.rb:222:in `in_batches'
activerecord-6.0.3.3/lib/active_record/relation/batches.rb:135:in `find_in_batches'
activerecord-6.0.3.3/lib/active_record/relation/batches.rb:69:in `find_each'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:127:in `user_list_export'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:66:in `each'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:66:in `block (2 levels) in execute'
/usr/local/lib/ruby/2.6.0/csv.rb:657:in `open'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:64:in `block in execute'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:63:in `each'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:63:in `execute'
/var/www/discourse/app/jobs/base.rb:232:in `block (2 levels) in perform'
rails_multisite-2.5.0/lib/rails_multisite/connection_management.rb:76:in `with_connection'
/var/www/discourse/app/jobs/base.rb:221:in `block in perform'
/var/www/discourse/app/jobs/base.rb:217:in `each'
/var/www/discourse/app/jobs/base.rb:217:in `perform'
sidekiq-6.1.2/lib/sidekiq/processor.rb:196:in `execute_job'
sidekiq-6.1.2/lib/sidekiq/processor.rb:164:in `block (2 levels) in process'
sidekiq-6.1.2/lib/sidekiq/middleware/chain.rb:138:in `block in invoke'
/var/www/discourse/lib/sidekiq/pausable.rb:138:in `call'
sidekiq-6.1.2/lib/sidekiq/middleware/chain.rb:140:in `block in invoke'
sidekiq-6.1.2/lib/sidekiq/middleware/chain.rb:143:in `invoke'
sidekiq-6.1.2/lib/sidekiq/processor.rb:163:in `block in process'
sidekiq-6.1.2/lib/sidekiq/processor.rb:136:in `block (6 levels) in dispatch'
sidekiq-6.1.2/lib/sidekiq/job_retry.rb:111:in `local'
sidekiq-6.1.2/lib/sidekiq/processor.rb:135:in `block (5 levels) in dispatch'
sidekiq-6.1.2/lib/sidekiq.rb:38:in `block in <module:Sidekiq>'
sidekiq-6.1.2/lib/sidekiq/processor.rb:131:in `block (4 levels) in dispatch'
sidekiq-6.1.2/lib/sidekiq/processor.rb:257:in `stats'
sidekiq-6.1.2/lib/sidekiq/processor.rb:126:in `block (3 levels) in dispatch'
sidekiq-6.1.2/lib/sidekiq/job_logger.rb:13:in `call'
sidekiq-6.1.2/lib/sidekiq/processor.rb:125:in `block (2 levels) in dispatch'
sidekiq-6.1.2/lib/sidekiq/job_retry.rb:78:in `global'
sidekiq-6.1.2/lib/sidekiq/processor.rb:124:in `block in dispatch'
sidekiq-6.1.2/lib/sidekiq/logger.rb:10:in `with'
sidekiq-6.1.2/lib/sidekiq/job_logger.rb:33:in `prepare'
sidekiq-6.1.2/lib/sidekiq/processor.rb:123:in `dispatch'
sidekiq-6.1.2/lib/sidekiq/processor.rb:162:in `process'
sidekiq-6.1.2/lib/sidekiq/processor.rb:78:in `process_one'
sidekiq-6.1.2/lib/sidekiq/processor.rb:68:in `run'
sidekiq-6.1.2/lib/sidekiq/util.rb:15:in `watchdog'
sidekiq-6.1.2/lib/sidekiq/util.rb:24:in `block in safe_thread'
env:
| hostname | ubuntu-s-1vcpu-1gb-nyc1-01-app |
|---|
|process_id|771|
|application_version|a47c8f05855a7b4a15d69dfbf3ef1e894a35f418|
|current_db|default|
|current_hostname|discourse.example.com|
|job|Jobs::ExportCsvFile|
|problem_db|default|
|time|3:10 pm|
|||
|opts||
|entity|user_list|
|user_id|1|
|current_site_id|default|
|||
|args||
|trust_level|active|
Any help troubleshooting this is really appreciated. TIA