Indexing Jira throws "LocalDate only handles the Common Era - no BC dates are allowed" error.

Still need help?

The Atlassian Community is here for you.

Ask the community

Symptoms

The following errors are thrown when trying to reindex:

java.lang.RuntimeException: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: LocalDate only handles the Common Era - no BC dates are allowed.
	at com.atlassian.jira.index.FutureResult.await(FutureResult.java:35)
	at com.atlassian.jira.index.CompositeResultBuilder$CompositeResult.await(CompositeResultBuilder.java:82)
....
	at java.lang.Thread.run(Thread.java:662)
Caused by: java.util.concurrent.ExecutionException: java.lang.IllegalArgumentException: LocalDate only handles the Common Era - no BC dates are allowed.
	at java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:222)
	at java.util.concurrent.FutureTask.get(FutureTask.java:83)
	at com.atlassian.jira.index.FutureResult.await(FutureResult.java:31)
	... 26 more
Caused by: java.lang.IllegalArgumentException: LocalDate only handles the Common Era - no BC dates are allowed.
	at com.atlassian.jira.datetime.LocalDateFactory.from(LocalDateFactory.java:63)
	at com.atlassian.jira.datetime.LocalDateFactory.from(LocalDateFactory.java:35)
	at com.atlassian.jira.issue.index.indexers.impl.DueDateIndexer.addIndex(DueDateIndexer.java:29)

Enabling debug packages for re-indexing will provide the exact table where the error is encountered:


2023-03-05 22:18:50,906+0000 IssueIndexer:thread-12 DEBUG xxxxxx 1338x283x1 19d10fk 172.19.2.10,10.42.2.0 /secure/admin/IndexReIndex!reindex.jspa [c.a.j.issue.index.DefaultWorklogDocumentFactory] Indexing worklog: issueId=35744, worklogId=11918, version=18
2023-03-05 22:18:50,908+0000 IssueIndexer:thread-12 WARN xxxxxx 1338x283x1 19d10fk 172.19.2.10,10.42.2.0 /secure/admin/IndexReIndex!reindex.jspa [c.a.jira.index.AccumulatingResultBuilder] java.lang.IllegalArgumentException: LocalDate only handles the Common Era - no BC dates are allowed.
java.lang.RuntimeException: java.lang.IllegalArgumentException: LocalDate only handles the Common Era - no BC dates are allowed.
at com.atlassian.jira.index.DefaultIndex$Failure.<init>(DefaultIndex.java:100)
at com.atlassian.jira.issue.index.DefaultIssueIndexer$EntityOperation.lambda$perform$6(DefaultIssueIndexer.java:862)
at java.base/java.util.HashMap.forEach(HashMap.java:1337)

Cause

There is an issue in Jira that has a date set in the BC era. e.g. 0001-12-07 22:24:30+05:53:28 BC. This could happen for any of the tables that has a date column, so the best way to find exact table impacted is by adding the following debug packages:

com.atlassian.jira.index
com.atlassian.jira.issue.index.DefaultIndexManager
com.atlassian.jira.index.AccumulatingResultBuilder

Solution

  • Based on the table from the debug logs, run the query in database to search for the incorrect date. The following example has the queries for incorrect date format in jiraissue table and worklog table:
    select * from jiraissue where duedate < '2000-01-01';
    OR
    select * from worklog where id = <worklogid from the debug logs>
  • Stop Jira
  • Change the date to an appropriate format.  e.g. 2012-12-07 22:24:30+05:30
  • Start Jira and perform full reindexing again.


Last modified on Mar 7, 2023

Was this helpful?

Yes
No
Provide feedback about this article
Powered by Confluence and Scroll Viewport.