quarkusio/quarkus · error · RuntimeException
Incorrect description: " + i1.getDescription() + ", expected
Error message
Incorrect description: " + i1.getDescription() + ", expected: " + expectedDesc[0]
What it means
Assertion inside findByIdItems for the first Item (id=1): after em.find(Item.class, 1L), the endpoint compares the item's description against expectedDesc[0] and throws this RuntimeException on mismatch. It validates that the read-only entity second-level cache serves the correct cached Item data.
Source
Thrown at integration-tests/hibernate-orm-cache/src/main/java/io/quarkus/it/hibernate/orm/cache/HibernateOrmCacheTestEndpoint.java:366
});
assertRegionStats(expected, Item.class.getName());
}
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");View on GitHub (pinned to e1c734241f)
Solutions
- Evict the Item entity region before verification (sessionFactory.getCache().evict(Item.class))
- Reset seed data so Item 1's description matches the expected value
- Check the cache concurrency strategy matches the mutation pattern of the test
- Clear statistics and cache between sub-tests
Example fix
// before final Item i1 = em.find(Item.class, 1L); if (!i1.getDescription().equals(expectedDesc[0])) throw ... // after sessionFactory.getCache().evict(Item.class); final Item i1 = em.find(Item.class, 1L); if (!i1.getDescription().equals(expectedDesc[0])) throw ...
Defensive patterns
Strategy: validation
Validate before calling
sessionFactory.getCache().evict(Item.class);
Item i1 = em.find(Item.class, 1L);
if (i1 == null) throw new IllegalStateException("Item 1 not seeded"); Try / catch
try {
findByIdItems(em, expectedDesc);
} catch (RuntimeException e) {
sessionFactory.getCache().evict(Item.class);
// reload; if it still fails, the DB data is wrong, not the cache
} Prevention
- Evict entity regions before switching from update to verification phases
- Reset DB to seed state between runs
- Assert cache statistics alongside data to spot unexpected hits
When it happens
Trigger: Verifying cached Items when the Item with id 1 in the cache (or database) has a description different from expectedDesc[0] — e.g. after the test updates descriptions and the cache still holds the old value, or seeding differs from expectations.
Common situations: Stale entity cache after a transactional update of descriptions; prior failed run left modified descriptions; read-write vs read-only cache strategy conflict; database reset not performed between runs.
Related errors
- Incorrect description: " + i2.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/9b531d887a3501b7.
Report an issue: GitHub.