# Importing devices in V3 with JSON generated by V2 ttn-lw-migrate tool fails

**URL:** <https://www.thethingsnetwork.org/forum/t/importing-devices-in-v3-with-json-generated-by-v2-ttn-lw-migrate-tool-fails/45169>\
**Category:** Migrating Devices to V3\
**Created:** [March 5, 2021, 12:31pm UTC](https://www.thethingsnetwork.org/forum/t/importing-devices-in-v3-with-json-generated-by-v2-ttn-lw-migrate-tool-fails/45169 "2021-03-05T12:31:54Z")\
**Posts on this page:** 9\
**Page:** 1

<div class="post-metadata">

**Author:** ![eddyhog](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/eddyhog/32/35697_2.png) [@eddyhog](https://www.thethingsnetwork.org/forum/u/eddyhog)\
**Post date:** [March 5, 2021, 12:31pm UTC](https://www.thethingsnetwork.org/forum/t/importing-devices-in-v3-with-json-generated-by-v2-ttn-lw-migrate-tool-fails/45169/1 "2021-03-05T12:31:54Z")

</div>

Based upon the process documentation "…/docs/getting-started/migrating/migrating-from-v2/ " I tried to migrate an OTAA test device.  
The V2 ttn-lw-migrate tool succesfully generated a JSON file which failed in the V3 “import end device” process.

The result of this import :  
{  
“code”: 3,  
“message”: “error:pkg/networkserver:field\_mask (invalid field mask)”,  
“details”: [  
{  
“@type”: “[type.googleapis.com/ttn.lorawan.v3.ErrorDetails](http://type.googleapis.com/ttn.lorawan.v3.ErrorDetails)”,  
“namespace”: “pkg/networkserver”,  
“name”: “field\_mask”,  
“message\_format”: “invalid field mask”,  
“correlation\_id”: “16fbb93b94fd49efab19e36ed5815f6f”,  
“cause”: {  
“namespace”: “pkg/ttnpb”,  
“name”: “prohibited\_field”,  
“message\_format”: “field `{field}` is prohibited”,  
“attributes”: {  
“field”: “session.keys.nwk\_s\_enc\_key.key”  
},  
“code”: 2  
},  
“code”: 3  
}  
],  
“request\_details”: {  
“url”: “/ns/applications/showcase/devices/leonardo005”,  
“method”: “put”,  
“stack\_component”: “ns”  
}  
}

Anyone a clue?

---

<div class="post-metadata">

**Author:** ![Tom\_B](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/tom_b/32/44490_2.png) [@Tom\_B](https://www.thethingsnetwork.org/forum/u/Tom_B)\
**Post date:** [March 22, 2021, 3:42pm UTC](https://www.thethingsnetwork.org/forum/t/importing-devices-in-v3-with-json-generated-by-v2-ttn-lw-migrate-tool-fails/45169/2 "2021-03-22T15:42:56Z")

</div>

I’m facing exactly the same issue. Did you find any solution yet, or do you have an idea what is causing the issue?

---

<div class="post-metadata">

**Author:** ![Tom\_B](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/tom_b/32/44490_2.png) [@Tom\_B](https://www.thethingsnetwork.org/forum/u/Tom_B)\
**Post date:** [March 23, 2021, 9:09am UTC](https://www.thethingsnetwork.org/forum/t/importing-devices-in-v3-with-json-generated-by-v2-ttn-lw-migrate-tool-fails/45169/3 "2021-03-23T09:09:26Z")

</div>

Made some tests and figured out, that the issue is caused by the “session”-part of the json-object. If I remove the session part it works fine.

The question for me now is why is this part generated by the migration tool. I’m using lorawan-stack-migrate\_0.3.0 to generate the json objects.

---

<div class="post-metadata">

**Author:** ![eddyhog](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/eddyhog/32/35697_2.png) [@eddyhog](https://www.thethingsnetwork.org/forum/u/eddyhog)\
**Post date:** [March 23, 2021, 10:11am UTC](https://www.thethingsnetwork.org/forum/t/importing-devices-in-v3-with-json-generated-by-v2-ttn-lw-migrate-tool-fails/45169/4 "2021-03-23T10:11:48Z")

</div>

Thanks for your effort, I will give it another try soon.

The session part is most likely generated to transfer live devices to V3, without a rejoin. Not all devices are accesable for maintenance.

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [March 23, 2021, 1:14pm UTC](https://www.thethingsnetwork.org/forum/t/importing-devices-in-v3-with-json-generated-by-v2-ttn-lw-migrate-tool-fails/45169/5 "2021-03-23T13:14:38Z")

</div>

> [@Tom\_B](#):
>
> The question for me now is why is this part generated by the migration tool

The v2 tool was created before v3 existed. It wasn’t created to provide data for v3 specifically.

---

<div class="post-metadata">

**Author:** ![Tom\_B](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/tom_b/32/44490_2.png) [@Tom\_B](https://www.thethingsnetwork.org/forum/u/Tom_B)\
**Post date:** [March 23, 2021, 3:41pm UTC](https://www.thethingsnetwork.org/forum/t/importing-devices-in-v3-with-json-generated-by-v2-ttn-lw-migrate-tool-fails/45169/6 "2021-03-23T15:41:10Z")

</div>

the tool **[lorawan-stack-migrate](https://github.com/TheThingsNetwork/lorawan-stack-migrate)** was initially commited to github on 26. November 2020, and version [v0.3.0-rc1](https://github.com/TheThingsNetwork/lorawan-stack-migrate/releases/tag/v0.3.0-rc1) was commited 8 Days ago.

So the tool came along with V3.

This might be a bit confusing

---

<div class="post-metadata">

**Author:** ![descartes](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/descartes/32/47220_2.png) [@descartes](https://www.thethingsnetwork.org/forum/u/descartes)\
**Post date:** [March 23, 2021, 3:52pm UTC](https://www.thethingsnetwork.org/forum/t/importing-devices-in-v3-with-json-generated-by-v2-ttn-lw-migrate-tool-fails/45169/7 "2021-03-23T15:52:47Z")

</div>

My apologies, I wasn’t aware of such a thing, I’ve been using the CLI tools as I had lots of scripts for v2 and I’m in the process of reworking the essential ones for v3, having reworked the v3 quick reference ([http://descartes.co.uk/TTSv3CLI.html](http://descartes.co.uk/TTSv3CLI.html)) so I can see all the options.

If you can, please submit a GitHub issue on this. I’ll have a look at the migration tool over the next few days.

---

<div class="post-metadata">

**Author:** ![eddyhog](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/eddyhog/32/35697_2.png) [@eddyhog](https://www.thethingsnetwork.org/forum/u/eddyhog)\
**Post date:** [March 26, 2021, 3:23pm UTC](https://www.thethingsnetwork.org/forum/t/importing-devices-in-v3-with-json-generated-by-v2-ttn-lw-migrate-tool-fails/45169/8 "2021-03-26T15:23:59Z")

</div>

Issue created. Thanks

---

<div class="post-metadata">

**Author:** ![eddyhog](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/eddyhog/32/35697_2.png) [@eddyhog](https://www.thethingsnetwork.org/forum/u/eddyhog)\
**Post date:** [March 30, 2021, 8:41am UTC](https://www.thethingsnetwork.org/forum/t/importing-devices-in-v3-with-json-generated-by-v2-ttn-lw-migrate-tool-fails/45169/9 "2021-03-30T08:41:31Z")

</div>

I overlooked the note that importing live sesions will be supported in stack V3.12. My mistake, sorry for that.
