quarkusio/quarkus · error · RuntimeException
Incorrect description: " + i2.getDescription() + ", expected
Error message
Incorrect description: " + i2.getDescription() + ", expected: " + expectedDesc[1]
What it means
Same assertion pattern as error 3927 but for the second Item (id=2): em.find(Item.class, 2L) must return an Item whose description equals expectedDesc[1], otherwise this RuntimeException is thrown. It guards against the second-level cache serving incorrect cached entity state.
Source
Thrown at integration-tests/hibernate-orm-cache/src/main/java/io/quarkus/it/hibernate/orm/cache/HibernateOrmCacheTestEndpoint.java:370
private void verifyFindByIdItems(String[] expectedDesc, Counts expected) {
clearStatistics();
QuarkusTransaction.requiringNew().run(() -> {
findByIdItems(em, expectedDesc);
});
assertRegionStats(expected, Item.class.getName());
}
private static void findByIdItems(EntityManager em, String[] expectedDesc) {
final Item i1 = em.find(Item.class, 1L);
if (!i1.getDescription().equals(expectedDesc[0]))
throw new RuntimeException("Incorrect description: " + i1.getDescription() + ", expected: " + expectedDesc[0]);
final Item i2 = em.find(Item.class, 2L);
if (!i2.getDescription().equals(expectedDesc[1]))
throw new RuntimeException("Incorrect description: " + i2.getDescription() + ", expected: " + expectedDesc[1]);
final Item i3 = em.find(Item.class, 3L);
if (!i3.getDescription().equals(expectedDesc[2]))
throw new RuntimeException("Incorrect description: " + i3.getDescription() + ", expected: " + expectedDesc[2]);
List<Item> allitems = Arrays.asList(i1, i2, i3);
if (allitems.size() != 3) {
throw new RuntimeException("Incorrect number of results");
}
StringBuilder sb = new StringBuilder("list of stored Items names:\n\t");
for (Item p : allitems)
p.describeFully(sb);
sb.append("\nList complete.\n");
System.out.print(sb);
}
private void testQuery() {View on GitHub (pinned to e1c734241f)
Solutions
- Evict the Item entity region before verification
- Reset the database to the seeded state before running the test
- Verify expectedDesc[1] matches the seeded/updated description for Item 2
- Inspect Item 2's actual stored description to determine if the DB or cache is stale
Example fix
// before final Item i2 = em.find(Item.class, 2L); if (!i2.getDescription().equals(expectedDesc[1])) throw ... // after sessionFactory.getCache().evict(Item.class); final Item i2 = em.find(Item.class, 2L); if (!i2.getDescription().equals(expectedDesc[1])) throw ...
Defensive patterns
Strategy: validation
Validate before calling
sessionFactory.getCache().evict(Item.class);
Item i2 = em.find(Item.class, 2L);
if (i2 == null) throw new IllegalStateException("Item 2 not seeded"); Try / catch
try {
findByIdItems(em, expectedDesc);
} catch (RuntimeException e) {
sessionFactory.getCache().evict(Item.class);
// reload to separate cache staleness from persistence issues
} Prevention
- Verify expected descriptions come from the same constants used for seeding
- Evict Item region after the update phase
- Run each verification phase with a known cache state
When it happens
Trigger: Verifying cached Items when Item 2's cached or persisted description differs from expectedDesc[1], typically after a prior update step changed descriptions and the cache/database state is inconsistent with expectations.
Common situations: Stale entity cache following the test's update phase; Item 2 modified by a previous run; seed dataset mismatch; cache strategy (read-write) not evicting on update.
Related errors
- Incorrect description: " + i1.getDescription() + ", expected
- Incorrect description: " + i3.getDescription() + ", expected
- Incorrect citizen: " + country.getName() + ", expected: " +
- Incorrect family size: " + pokemons.size() + ", expected: "
- Cache for region %s not found
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/23ce29a478ed2034.
Report an issue: GitHub.