Download my posts error

AI-generated summary

The thread addresses a persistent error occurring when users attempt to “Download My Posts” on Discourse v1.3.0.beta9. The issue manifests as a NoMethodError where the system tries to call category or archetype on a nil object, indicating a post is not linked to a topic. tudorv reported that while some users are affected, others can export successfully, and provided detailed server logs. codinghorror flagged the issue for the technical team. techAPJ confirmed they could not reproduce the specific case but successfully simulated the error locally, submitting a fix via PR #3486. After techAPJ requested an update to the latest build, tudorv confirmed that upgrading to v1.3.0.beta9 +98 resolved the problem.

Continuing the discussion from ERROR with Download My Posts on v1.3.0.beta9:

I am still getting this error and my forum runs on Discourse v1.3.0.beta9 +92.

Logs below:

Message

Job exception: undefined method `archetype' for nil:NilClass
Share Protect
Backtrace

/var/www/discourse/app/jobs/regular/export_csv_file.rb:150:in `get_user_archive_fields'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:47:in `block in user_archive_export'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:46:in `map'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:46:in `user_archive_export'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:30:in `execute'
/var/www/discourse/app/jobs/base.rb:153:in `block (2 levels) in perform'Share Protect
Env

current_db: default
current_hostname: macforum.ro
job: Jobs::ExportCsvFile
problem_db: default

opts:
  entity: user_archive
  user_id: 1
  current_site_id: default

…

Message

Job exception: Wrapped NoMethodError: undefined method `archetype' for nil:NilClass
Share Protect
Backtrace

/var/www/discourse/app/jobs/base.rb:178:in `perform'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sidekiq-3.3.2/lib/sidekiq/processor.rb:75:in `execute_job'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sidekiq-3.3.2/lib/sidekiq/processor.rb:52:in `block (2 levels) in process'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sidekiq-3.3.2/lib/sidekiq/middleware/chain.rb:127:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sidekiq-3.3.2/lib/sidekiq/middleware/chain.rb:127:in `block in invoke'
/var/www/discourse/lib/sidekiq/pausable.rb:81:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sidekiq-3.3.2/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sidekiq-3.3.2/lib/sidekiq/middleware/server/active_record.rb:6:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sidekiq-3.3.2/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sidekiq-3.3.2/lib/sidekiq/middleware/server/retry_jobs.rb:74:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sidekiq-3.3.2/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sidekiq-3.3.2/lib/sidekiq/middleware/server/logging.rb:11:in `block in call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sidekiq-3.3.2/lib/sidekiq/logging.rb:24:in `with_context'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sidekiq-3.3.2/lib/sidekiq/middleware/server/logging.rb:7:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sidekiq-3.3.2/lib/sidekiq/middleware/chain.rb:129:in `block in invoke'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sidekiq-3.3.2/lib/sidekiq/middleware/chain.rb:132:in `call'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sidekiq-3.3.2/lib/sidekiq/middleware/chain.rb:132:in `invoke'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sidekiq-3.3.2/lib/sidekiq/processor.rb:51:in `block in process'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sidekiq-3.3.2/lib/sidekiq/processor.rb:98:in `stats'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/sidekiq-3.3.2/lib/sidekiq/processor.rb:50:in `process'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `public_send'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:26:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/celluloid-0.16.0/lib/celluloid/calls.rb:122:in `dispatch'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/celluloid-0.16.0/lib/celluloid/cell.rb:60:in `block in invoke'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/celluloid-0.16.0/lib/celluloid/cell.rb:71:in `block in task'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/celluloid-0.16.0/lib/celluloid/actor.rb:357:in `block in task'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/celluloid-0.16.0/lib/celluloid/tasks.rb:57:in `block in initialize'
/var/www/discourse/vendor/bundle/ruby/2.0.0/gems/celluloid-0.16.0/lib/celluloid/tasks/task_fiber.rb:15:in `block in create'Share Protect
Env

retry: false
queue: default
class: Jobs::ExportCsvFile
jid: b7c66b9c58a3d70d4124ef97
enqueued_at: 1431877965.7720158
current_hostname: macforum.ro

args:
  0: [object Object]

Anything to do here @techapj?

I am still unable to repro this case where post is not linked to a topic (which seems to be the cause for this error), however I simulated this exact error locally and sent a PR to fix:

https://github.com/discourse/discourse/pull/3486

@tudorv can you update your instance to the latest version and verify if it’s working as expected now? (cc @raul_pareja, @tobiaseigen)

Yes, I’m on v1.3.0.beta9 +98 and it works fine now. Thanks!