# RegisterNamespace throws an error Invalid RetentionDays when my retention in days is \> 30 (java sdk)

**URL:** <https://community.temporal.io/t/registernamespace-throws-an-error-invalid-retentiondays-when-my-retention-in-days-is-30-java-sdk/1954>\
**Category:** Community Support\
**Tags:** java-sdk, namespace\
**Created:** [April 19, 2021, 5:51am UTC](https://community.temporal.io/t/registernamespace-throws-an-error-invalid-retentiondays-when-my-retention-in-days-is-30-java-sdk/1954 "2021-04-19T05:51:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Priyanka\_Khatri](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/priyanka_khatri/32/802_2.png) [@Priyanka\_Khatri](https://community.temporal.io/u/Priyanka_Khatri)\
**Post date:** [April 19, 2021, 5:51am UTC](https://community.temporal.io/t/registernamespace-throws-an-error-invalid-retentiondays-when-my-retention-in-days-is-30-java-sdk/1954/1 "2021-04-19T05:51:47Z")

</div>

Hi,

RegisterNamespace throws an error saying “Invalid RetentionDays” when my retention in days is \> 30  
I am using below code to register namespace

```auto
WorkflowServiceStubs service = WorkflowServiceStubs.newInstance(WorkflowServiceStubsOptions.newBuilder()
                    .setTarget(temporalServerAddress).build());
            RegisterNamespaceRequest request =
                    RegisterNamespaceRequest.newBuilder()
                            .setNamespace(namespace)
                            .setWorkflowExecutionRetentionPeriod(Durations.fromDays(31))
                            .build();
            RegisterNamespaceResponse response = service.blockingStub().registerNamespace(request);    

```

---

<div class="post-metadata">

**Author:** ![Wenquan\_Xing](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/wenquan_xing/32/362_2.png) [@Wenquan\_Xing](https://community.temporal.io/u/Wenquan_Xing)\
**Post date:** [April 22, 2021, 10:55pm UTC](https://community.temporal.io/t/registernamespace-throws-an-error-invalid-retentiondays-when-my-retention-in-days-is-30-java-sdk/1954/2 "2021-04-22T22:55:06Z")

</div>

Currently the max retention days allowed by the server is 30 days.

---

<div class="post-metadata">

**Author:** ![Priyanka\_Khatri](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/priyanka_khatri/32/802_2.png) [@Priyanka\_Khatri](https://community.temporal.io/u/Priyanka_Khatri)\
**Post date:** [April 23, 2021, 8:34am UTC](https://community.temporal.io/t/registernamespace-throws-an-error-invalid-retentiondays-when-my-retention-in-days-is-30-java-sdk/1954/3 "2021-04-23T08:34:04Z")

</div>

can we increase that in some way by any temporal-server docker setting or any other way??

---

<div class="post-metadata">

**Author:** ![samar](https://sea2.discourse-cdn.com/flex016/user_avatar/community.temporal.io/samar/32/12_2.png) [@samar](https://community.temporal.io/u/samar)\
**Post date:** [April 25, 2021, 4:40pm UTC](https://community.temporal.io/t/registernamespace-throws-an-error-invalid-retentiondays-when-my-retention-in-days-is-30-java-sdk/1954/4 "2021-04-25T16:40:33Z")

</div>

This is defined as a [constant](https://github.com/temporalio/temporal/blob/5d924f47b8e8a2f91375f53728077b451464e1e7/common/constants.go#L99). The only way to change that is to update the constant and rebuild your own binary.  
If you need higher retention, I would recommend to look into setting up Archival.
