NSRangeException when typing letters with macron

For example when I hold the key “a”, OSX shows multiple variants of “a”. When I select “ā” (amacron), I get following message:

text: ‘chai‌lethuiiy’ (__NSCFString), length: 13, string: ‘ā{
}’ (NSConcreteAttributedString), length: 1, range: {14, 0}

NSRangeException

NSMutableRLEArray insertObject:range:: Out of bounds

(
“3 Foundation 0x00007fff4d4d6563 -[NSMutableRLEArray insertObject:range:] + 151”,
“4 Foundation 0x00007fff4d4d70df -[NSConcreteMutableAttributedString replaceCharactersInRange:withAttributedString:] + 242”,
“5 Glyphs 0x0000000108565128 Glyphs + 323880”,
“6 AppKit 0x00007fff48ab88c5 -[NSTextInputContext(NSInputContext_WithCompletion) insertText:replacementRange:completionHandler:] + 75”,
“7 AppKit 0x00007fff4934a5f5 __55-[NSTextInputContext handleTSMEvent:completionHandler:]_block_invoke_2.385 + 109”,
“8 AppKit 0x00007fff48ab8874 -[NSTextInputContext do_HandleTSMEvent_insertFixLenTextLoop:whileCondition:dispatchWorkEach:afterEachInsertText:continuation:] + 110”,
“9 AppKit 0x00007fff4934856d -[NSTextInputContext tryHandleTSMEvent_insertFixLenText_withContext:dispatchCondition:setupForDispatch:nestedWorkaroundCondition:nestedWorkaroundDispatchWork:loopCondition:dispatchWorkEach:afterEachInsertText:continuation:] + 320”
)