# Download My Posts failed

**URL:** https://meta.discourse.org/t/download-my-posts-failed/67613
**Category:** Support
**Created:** [August 7, 2017, 8:33pm UTC](https://meta.discourse.org/t/download-my-posts-failed/67613 "2017-08-07T20:33:56Z")
**Posts on this page:** 10
**Page:** 1

<div class="post-metadata">

### Author: ![moparisthebest](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moparisthebest/32/116760_2.png) [@moparisthebest](https://meta.discourse.org/u/moparisthebest)
#### Post date: [August 7, 2017, 8:33pm UTC](https://meta.discourse.org/t/download-my-posts-failed/67613/1 "2017-08-07T20:33:56Z")

</div>

User informed me they could not download their posts, I tried as well (button in user/activity), I get a message saying “Data export failed” and this is in the logs:

```
Message

Job exception: undefined method `name' for nil:NilClass

Backtrace

/var/www/discourse/app/jobs/regular/export_csv_file.rb:226:in `get_user_archive_fields'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:66:in `block in user_archive_export'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.8/lib/active_record/relation/delegation.rb:46:in `each'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.8/lib/active_record/relation/delegation.rb:46:in `each'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:65:in `user_archive_export'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:48:in `each'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:48:in `block in execute'
/usr/local/lib/ruby/2.3.0/csv.rb:1282:in `open'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:46:in `execute'
/var/www/discourse/app/jobs/base.rb:154:in `block (2 levels) in perform'

Env
hostname	hetzner1-smf
process_id	1372
application_version	ae8bd6c8258f729025656705545a45992fa82f9c
current_db	default
current_hostname	forum.moparisthebest.com
job	Jobs::ExportCsvFile
problem_db	default
	
opts	null
entity	user_archive
user_id	1
current_site_id	default

I am on current discourse stable v1.8.4 installed the supported way through docker on ubuntu.

```

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [August 7, 2017, 11:16pm UTC](https://meta.discourse.org/t/download-my-posts-failed/67613/2 "2017-08-07T23:16:09Z")

</div>

If this is a bug (can we repro @techapj?) we would only fix it in the current 1.9 beta.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [August 8, 2017, 7:34am UTC](https://meta.discourse.org/t/download-my-posts-failed/67613/3 "2017-08-08T07:34:24Z")

</div>

I am unable to repro this on `tests-passed` branch.

@moparisthebest if you wish to change the tracking branch see this topic:

> [@Configure a supported tracking branch to get Discourse software updates](https://meta.discourse.org/t/change-tracking-branch-for-your-discourse-instance/17014/):
>
> bookmark This guide explains how to configure a supported tracking branch for your Discourse instance to manage software updates. person_raising_hand Required user level: System Administrator warning Console access is required. Managing your Discourse instance’s tracking branch determines the frequency and type of updates you receive. This guide explains the different tracking branches available and provides a step-by-step approach to changing the branch on your setup. Summary Disco…

---

<div class="post-metadata">

### Author: ![moparisthebest](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moparisthebest/32/116760_2.png) [@moparisthebest](https://meta.discourse.org/u/moparisthebest)
#### Post date: [August 8, 2017, 2:29pm UTC](https://meta.discourse.org/t/download-my-posts-failed/67613/4 "2017-08-08T14:29:08Z")

</div>

I just upgraded to the tests-passed branch, but I get the same error, currently on v1.9.0.beta5 +73:

```
Message

Job exception: undefined method `name' for nil:NilClass

Backtrace

/var/www/discourse/app/jobs/regular/export_csv_file.rb:226:in `get_user_archive_fields'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:66:in `block in user_archive_export'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.9/lib/active_record/relation/delegation.rb:46:in `each'
/var/www/discourse/vendor/bundle/ruby/2.3.0/gems/activerecord-4.2.9/lib/active_record/relation/delegation.rb:46:in `each'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:65:in `user_archive_export'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:48:in `each'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:48:in `block in execute'
/usr/local/lib/ruby/2.3.0/csv.rb:1282:in `open'
/var/www/discourse/app/jobs/regular/export_csv_file.rb:46:in `execute'
/var/www/discourse/app/jobs/base.rb:153:in `block (2 levels) in perform'

Env
hostname	hetzner1-smf
process_id	118
application_version	aab0b06cbe20535abcc484d7b0cd67d8fe033867
current_db	default
current_hostname	forum.moparisthebest.com
job	Jobs::ExportCsvFile
problem_db	default
	
opts	null
entity	user_archive
user_id	1
current_site_id	default

```

So the original reporting user made a new account, made a post, and export posts worked for that new account. My only thought is this forum and users were imported from an SMF forum using the included importer, did it not do something correctly?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [August 8, 2017, 9:07pm UTC](https://meta.discourse.org/t/download-my-posts-failed/67613/5 "2017-08-08T21:07:13Z")

</div>

Looks like the import did something incorrect with the data, then.

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [August 9, 2017, 9:13am UTC](https://meta.discourse.org/t/download-my-posts-failed/67613/6 "2017-08-09T09:13:49Z")

</div>

The error you are seeing is most probably because of incorrect ID saved for a parent category. I just pushed a fix to handle the error and continue exporting archive.

[https://github.com/discourse/discourse/commit/e993d53260d465d02fee7d70841dc6108fa56f0a](https://github.com/discourse/discourse/commit/e993d53260d465d02fee7d70841dc6108fa56f0a)

---

<div class="post-metadata">

### Author: ![moparisthebest](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moparisthebest/32/116760_2.png) [@moparisthebest](https://meta.discourse.org/u/moparisthebest)
#### Post date: [August 10, 2017, 6:06pm UTC](https://meta.discourse.org/t/download-my-posts-failed/67613/7 "2017-08-10T18:06:39Z")

</div>

Thanks for the patch!

Is there a way to pull just that commit into my discourse without changing the version from tests-passed to master? Alternatively, when will that be in tests-passed? 🙂

---

<div class="post-metadata">

### Author: ![techAPJ](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/techapj/32/342990_2.png) [@techAPJ](https://meta.discourse.org/u/techAPJ)
#### Post date: [August 10, 2017, 6:08pm UTC](https://meta.discourse.org/t/download-my-posts-failed/67613/8 "2017-08-10T18:08:00Z")

</div>

> [@moparisthebest](#):
>
> Alternatively, when will that be in tests-passed?

It’s already in `tests-passed`. 😉

---

<div class="post-metadata">

### Author: ![moparisthebest](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/moparisthebest/32/116760_2.png) [@moparisthebest](https://meta.discourse.org/u/moparisthebest)
#### Post date: [August 10, 2017, 7:44pm UTC](https://meta.discourse.org/t/download-my-posts-failed/67613/9 "2017-08-10T19:44:06Z")

</div>

Ah, I couldn’t upgrade in the ui, but command line did just fine 🙂

Also great news, that fixed it and exports now work. Would it be worth trying to fix the missing parent category problem somehow too?

---

<div class="post-metadata">

### Author: ![codinghorror](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/codinghorror/32/110067_2.png) [@codinghorror](https://meta.discourse.org/u/codinghorror)
#### Post date: [August 10, 2017, 8:17pm UTC](https://meta.discourse.org/t/download-my-posts-failed/67613/10 "2017-08-10T20:17:09Z")

</div>


