hibernate/hibernate-orm · error · IllegalStateException

character [{}] is not the next non-blank character

Error message

character [{}] is not the next non-blank character

What it means

moveTo(character) skips whitespace and asserts that a specific character (always the opening quote, since its only caller is consumeQuotedString()) is the next non-blank character; it throws when some other non-blank character appears first, naming the expected character in the message. In current code paths the position is already on the quote when this runs, so reaching this exception implies corrupted parser state or an unexplored edge case rather than ordinary bad input.

Source

Thrown at hibernate-core/src/main/java/org/hibernate/type/format/StringJsonDocumentReader.java:302

	 */

	private void moveTo(char character) throws IllegalStateException {
		int pointer = this.position;
		while ( pointer < this.limit) {
			char c = this.jsonString.charAt( pointer );
			if ( c == character) {
				this.position = pointer == this.position?this.position:pointer - 1;
				return;
			}
			if (!Character.isWhitespace(c)) {
				// we did find an unexpected character
				// let the exception raise
				//this.json.reset();
				break;
			}
			pointer++;
		}
		throw new IllegalStateException("character [" + character + "] is not the next non-blank character");
	}

	private int nextQuote() {
		int pointer = this.position;

		while ( pointer < this.limit) {
			final char c = this.jsonString.charAt( pointer );
			if (c == ESCAPE_CHAR) {
				pointer++;
			}
			else if (c == '"') {
				// found
				return pointer;
			}
			pointer++;
		}
		return -1;
	}

View on GitHub (pinned to fad1729dce)

Solutions

  1. Reproduce with the exact JSON string and capture the stack trace
  2. Audit for a reader instance shared between threads; use one reader per document/thread
  3. Report to Hibernate JIRA with the payload and access pattern
Defensive patterns

Strategy: try-catch

Try / catch

try {
    while (reader.hasNext()) { handle(reader.next()); }
} catch (IllegalStateException e) {
    if (e.getMessage() != null && e.getMessage().contains("is not the next non-blank character")) {
        // internal parser-state failure: collect payload for a Hibernate bug report
        log.error("StringJsonDocumentReader state corruption", e);
    }
    throw e;
}

Prevention

When it happens

Trigger: Not reachable through normal public usage: consumeQuotedString() is only invoked from the QUOTE case of next() after moveBufferPosition(-1) puts the position back on the '"'. Would surface from an internal regression or from sharing one reader instance across threads (the reader is stateful and not thread-safe).

Common situations: Virtually unseen; treat as a Hibernate bug signal if it occurs — typically alongside concurrent use of a single StringJsonDocumentReader.

Related errors


AI-assisted analysis of hibernate/hibernate-orm@fad1729dce (2026-08-22). Data as JSON: /api/errors/414836777583e591. Report an issue: GitHub.