Exception - freetext-reindex java.lang.IllegalStateException: it.textValue must not be null

Platform Notice: Data Center - This article applies to Atlassian products on the Data Center platform.

Note that this knowledge base article was created for the Data Center version of the product. Data Center knowledge base articles for non-Data Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible


Problem

You may be getting the below error message when making the following actions:

  • On Jira restart when Insight Index is kicked out 

  • Running a manual Insight Re-index or Clean re-index

The following appears in the atlassian-jira.log

2021-11-18 12:58:29,228+0100 insight-event-1 ERROR Anonymous user     [i.r.a.s.service.freetext.FreeTextIndexingServiceJiraImpl] Fail re-indexing - ProgressId: resourceId: freetext, category: freetext-reindex!
java.lang.IllegalStateException: it.textValue must not be null
	at io.riada.assetmgt.search.service.freetext.lucene.jira8.LuceneIndexWriterImpl$buildDocument$1$1.invoke(LuceneIndexWriterImpl.kt:74)
	at io.riada.assetmgt.search.service.freetext.lucene.jira8.LuceneIndexWriterImpl$buildDocument$1$1.invoke(LuceneIndexWriterImpl.kt:21)
	at kotlin.sequences.TransformingSequence$iterator$1.next(Sequences.kt:172)
	at kotlin.collections.CollectionsKt__MutableCollectionsKt.addAll(MutableCollections.kt:131)
	at io.riada.assetmgt.search.service.freetext.lucene.jira8.LuceneIndexWriterImpl.buildDocument(LuceneIndexWriterImpl.kt:70)
	at io.riada.assetmgt.search.service.freetext.lucene.jira8.LuceneIndexWriterImpl.addObject(LuceneIndexWriterImpl.kt:32)
	at io.riada.assetmgt.search.service.freetext.FreeTextIndexingServiceJiraImpl$reIndexSchemas$1$$special$$inlined$forEach$lambda$1.invoke(FreeTextIndexingServiceJiraImpl.kt:147)
	at io.riada.assetmgt.search.service.freetext.FreeTextIndexingServiceJiraImpl$reIndexSchemas$1$$special$$inlined$forEach$lambda$1.invoke(FreeTextIndexingServiceJiraImpl.kt:26)
	at io.riada.assetmgt.search.service.freetext.FreeTextIndexingServiceJiraImpl.searchObjects(FreeTextIndexingServiceJiraImpl.kt:180)
	at io.riada.assetmgt.search.service.freetext.FreeTextIndexingServiceJiraImpl.searchObjects$default(FreeTextIndexingServiceJiraImpl.kt:170)
	at io.riada.assetmgt.search.service.freetext.FreeTextIndexingServiceJiraImpl$reIndexSchemas$1.invoke(FreeTextIndexingServiceJiraImpl.kt:143)
	at io.riada.assetmgt.search.service.freetext.FreeTextIndexingServiceJiraImpl$reIndexSchemas$1.invoke(FreeTextIndexingServiceJiraImpl.kt:26)
	at io.riada.assetmgt.search.service.freetext.FreeTextIndexingServiceJiraImpl$runUnderIndexing$1.invoke(FreeTextIndexingServiceJiraImpl.kt:259)
	at io.riada.assetmgt.search.service.freetext.FreeTextIndexingServiceJiraImpl$runUnderIndexing$1.invoke(FreeTextIndexingServiceJiraImpl.kt:26)
	at io.riada.assetmgt.search.service.freetext.FreeTextIndexingServiceJiraImpl.runUnderNoPermissionCheck(FreeTextIndexingServiceJiraImpl.kt:237)
	at io.riada.assetmgt.search.service.freetext.FreeTextIndexingServiceJiraImpl.runUnderIndexing(FreeTextIndexingServiceJiraImpl.kt:250)
	at io.riada.assetmgt.search.service.freetext.FreeTextIndexingServiceJiraImpl.reIndexSchemas(FreeTextIndexingServiceJiraImpl.kt:127)
	at io.riada.assetmgt.search.service.freetext.FreeTextIndexingServiceJiraImpl.access$reIndexSchemas(FreeTextIndexingServiceJiraImpl.kt:26)
	at io.riada.assetmgt.search.service.freetext.FreeTextIndexingServiceJiraImpl$reIndex$1.invoke(FreeTextIndexingServiceJiraImpl.kt:62)
	at io.riada.assetmgt.search.service.freetext.FreeTextIndexingServiceJiraImpl$reIndex$1.invoke(FreeTextIndexingServiceJiraImpl.kt:26)
	at io.riada.assetmgt.search.service.freetext.FreeTextIndexingServiceJiraImpl.runUnderNoPermissionCheck(FreeTextIndexingServiceJiraImpl.kt:237)
	at io.riada.assetmgt.search.service.freetext.FreeTextIndexingServiceJiraImpl.reIndex(FreeTextIndexingServiceJiraImpl.kt:58)
	at io.riada.assetmgt.search.service.freetext.FreeTextInsightObjectEventListener.onProgressEvent(FreeTextInsightObjectEventListener.kt:58)

Diagnosis

Environment

  • Any Insight versions

Diagnostic Steps

  • Verify if there is an inconsistency with the Objects Types and their values in the database.

    SELECT * FROM "AO_8542F1_IFJ_OBJ_ATTR" OA, "AO_8542F1_IFJ_OBJ_ATTR_VAL" OAV 
    WHERE OAV."OBJECT_ATTRIBUTE_ID" = OA."ID" 
    AND OAV."TEXT_VALUE" IS NULL 
    AND OA."OBJECT_TYPE_ATTRIBUTE_ID" IN (SELECT "ID" FROM "AO_8542F1_IFJ_OBJ_TYPE_ATTR" OTA WHERE OTA."DEFAULT_TYPE_ID" IN (0,9));
  • If you hit any, you are affected by this issue and you need to proceed and update the missing objectAttributeValueBean.


Cause

The error message occurs during the FreeText indexing because there is a missing data attribute value in the Insight Tables within Jira database.  There are ObjectAttributeBeans of Text or TextArea attributes which have an objectAttributeValueBean added to them, but there is no actual value saved. This is an "impossible". 


Solution

  1. Manipulate the database by adding a random text value, for instance, "XOXOXOXOX", but it could be any other!
  2. The reason to add a text value is that later on we can identify those attributes in Insight to either perform a bulk edit or set any other value or even set no value
  3. In Insight, you can use IQL Search to filter the affected objects


Resolution

Always back up your data before performing any modifications to the database. If possible, test any alter, insert, update, or delete SQL commands on a staging server first.

These queries were written for Postgres and may have to be updated to work on another database:

  1. Stop Jira

  2. Run below query to identify the objects attributes values affected

    SELECT * FROM "AO_8542F1_IFJ_OBJ_ATTR" OA, "AO_8542F1_IFJ_OBJ_ATTR_VAL" OAV 
    WHERE OAV."OBJECT_ATTRIBUTE_ID" = OA."ID" 
    AND OAV."TEXT_VALUE" IS NULL 
    AND OA."OBJECT_TYPE_ATTRIBUTE_ID" IN (SELECT "ID" FROM "AO_8542F1_IFJ_OBJ_TYPE_ATTR" OTA WHERE OTA."DEFAULT_TYPE_ID" IN (0,9));
  3. Update "TEXT_VALUE" with a random value - e.g. "XOXOXOXOX"

    update "AO_8542F1_IFJ_OBJ_ATTR_VAL" OAV
    set "TEXT_VALUE" = 'XOXOXOXOX'
    where OAV."ID" in (SELECT OAV."ID" FROM "AO_8542F1_IFJ_OBJ_ATTR" OA, "AO_8542F1_IFJ_OBJ_ATTR_VAL" OAV
    WHERE OAV."OBJECT_ATTRIBUTE_ID" = OA."ID" AND OAV."TEXT_VALUE" IS NULL 
    AND OA."OBJECT_TYPE_ATTRIBUTE_ID" IN (SELECT "ID" FROM "AO_8542F1_IFJ_OBJ_TYPE_ATTR" OTA WHERE OTA."DEFAULT_TYPE_ID" IN (0,9)))

    The query is designed to impact this null field under the "text_value" and there are other fields, such as "text_value_short" which contain a similar value. Due to this, you might not see any change in the UI but the underlying data will be corrected in order to resolve this error.

  4. Start Jira 
  5. Perform an Insight Clean Re-Index.
  6. Verify in atlassian-jira.log if the error message is thrown.
  7. Go to Insight and use the following IQL to filter the affected objects

    anyAttribute = "XOXOXOXOX" 

  8. You will need to verify if those objects are valid and either bulk clear the Attributes affected via Insight or edit them if needed









Last modified on Sep 25, 2023

Was this helpful?

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