# CLI: Unable to claim gateway - error with gateway-id format

**URL:** <https://www.thethingsnetwork.org/forum/t/cli-unable-to-claim-gateway-error-with-gateway-id-format/70869>\
**Category:** The Things Stack v3\
**Created:** [March 12, 2025, 10:42am UTC](https://www.thethingsnetwork.org/forum/t/cli-unable-to-claim-gateway-error-with-gateway-id-format/70869 "2025-03-12T10:42:34Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![echarlus](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/echarlus/32/35697_2.png) [@echarlus](https://www.thethingsnetwork.org/forum/u/echarlus)\
**Post date:** [March 12, 2025, 10:42am UTC](https://www.thethingsnetwork.org/forum/t/cli-unable-to-claim-gateway-error-with-gateway-id-format/70869/1 "2025-03-12T10:42:35Z")

</div>

Hi All,  
I’m trying to claim a TTIG Gateway using ttn-lw-cli but it fails with an error stating that the gateway ID is not conform to requirements.  
However, the id I’m using matches the pattern used to enforce GW ID format so I guess there’s another error somewhere but I cannot find it.  
Has anyone succeeded in claiming through cli ? (this is on a TTN Cloud instance):

`ttn-lw-cli -c .ttn-lw-cli.yml gateways claim --gateway-id ttig-test-01 --gateway-eui VALID_EUI --authentication-code 'edofrvwD' --organization-id my-org --target-frequency-plan-id EU_863_870_TTN --target-gateway-server-address XXX.eu1.cloud.thethings.industries`

I’m getting this error :

`error:pkg/errors:validation (invalid `gateway`: embedded message failed validation) name=CreateGatewayRequestValidationError field=gateway reason=embedded message failed validation correlation_id=48cad067d52f4d628d863ee99210eaae --- error:pkg/errors:validation (invalid `ids`: embedded message failed validation) field=ids reason=embedded message failed validation name=GatewayValidationError correlation_id=4308af927daf45aaa86013a50352b0ff --- error:pkg/errors:validation (invalid `gateway\_id`: value does not match regex pattern "^[a-z0-9](?:[-]?[a-z0-9]){2,}$") name=GatewayIdentifiersValidationError field=gateway_id reason=value does not match regex pattern "^[a-z0-9](?:[-]?[a-z0-9]){2,}$" correlation_id=2ca74cacd9fb46d98d976f66e58de5a6`

But the ID I used ttig-test-01 does indeed match the pattern \[1\](?:[-]?[a-z0-9]){2,}$”  
Has anyone succeeded in claiming using cli ?  
Thanks

* * *

1. a-z0-9

---

<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 12, 2025, 10:56am UTC](https://www.thethingsnetwork.org/forum/t/cli-unable-to-claim-gateway-error-with-gateway-id-format/70869/2 "2025-03-12T10:56:13Z")

</div>

If this is a one off activity, best just use the web console & move on.

If you need to script this for future claims, then best use the web console to see what it sends to the backend as a hint for the CLI.

The CLI is prone to giving misleading errors - it may be that there is another issue and it’s tripping over the gateway id. The web console should say precisely what’s wrong.

---

<div class="post-metadata">

**Author:** ![echarlus](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/echarlus/32/35697_2.png) [@echarlus](https://www.thethingsnetwork.org/forum/u/echarlus)\
**Post date:** [March 12, 2025, 10:59am UTC](https://www.thethingsnetwork.org/forum/t/cli-unable-to-claim-gateway-error-with-gateway-id-format/70869/3 "2025-03-12T10:59:28Z")

</div>

Hi Nick,  
thanks for the answer. The ID is to batch a bunch of claiming that’s why I do not wan to use the web console.  
I’ve done the claiming through the web console and it worked fine, no issues reported.  
So I guess there’s a cli bug lying somewhere ☹

---

<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 12, 2025, 11:00am UTC](https://www.thethingsnetwork.org/forum/t/cli-unable-to-claim-gateway-error-with-gateway-id-format/70869/4 "2025-03-12T11:00:20Z")

</div>

> [@echarlus](#):
>
> I’ve done the claiming through the web console and it worked fine, no issues reported.

Did you capture the http traffic so you can …

> [@descartes](#):
>
> see what it sends to the backend as a hint for the CLI.

---

<div class="post-metadata">

**Author:** ![echarlus](https://www.thethingsnetwork.org/forum/user_avatar/www.thethingsnetwork.org/echarlus/32/35697_2.png) [@echarlus](https://www.thethingsnetwork.org/forum/u/echarlus)\
**Post date:** [March 12, 2025, 11:01am UTC](https://www.thethingsnetwork.org/forum/t/cli-unable-to-claim-gateway-error-with-gateway-id-format/70869/5 "2025-03-12T11:01:01Z")

</div>

I’ll try that, good idea. Thanks
