How to reproduce:
Create a script retrieving contents, with some columns, with at least one nonexistant column
ex on ODF Web template :
let catalog = "2024-2025"; let contents = Repository.query(`//element(*, ametys:content)[@ametys-internal:publishable = 'false' and @ametys:catalog='${catalog}']`);return Content.toGridFormat(["title", "toto"], contents);
A polyglot error occurs
The Context is already closed. java.lang.IllegalStateException: The Context is already closed. at com.oracle.truffle.polyglot.PolyglotEngineException.closedException(PolyglotEngineException.java:137) at com.oracle.truffle.polyglot.PolyglotContextImpl.checkClosedOrDisposing(PolyglotContextImpl.java:1454) at com.oracle.truffle.polyglot.PolyglotContextImpl.enterThreadChanged(PolyglotContextImpl.java:861) at com.oracle.truffle.polyglot.PolyglotEngineImpl.enterCached(PolyglotEngineImpl.java:2100) at com.oracle.truffle.polyglot.HostToGuestRootNode.execute(HostToGuestRootNode.java:109) at com.oracle.truffle.api.impl.DefaultCallTarget.callDirectOrIndirect(DefaultCallTarget.java:85) at com.oracle.truffle.api.impl.DefaultCallTarget.call(DefaultCallTarget.java:102) at com.oracle.truffle.polyglot.PolyglotList.size(PolyglotList.java:135) at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serialize(CollectionSerializer.java:97) at com.fasterxml.jackson.databind.ser.std.CollectionSerializer.serialize(CollectionSerializer.java:25) at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeFields(MapSerializer.java:808) at com.fasterxml.jackson.databind.ser.std.MapSerializer.serializeWithoutTypeInfo(MapSerializer.java:764) at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:720) at com.fasterxml.jackson.databind.ser.std.MapSerializer.serialize(MapSerializer.java:35) at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider._serialize(DefaultSerializerProvider.java:502) at com.fasterxml.jackson.databind.ser.DefaultSerializerProvider.serializeValue(DefaultSerializerProvider.java:341) at com.fasterxml.jackson.databind.ObjectMapper.writeValue(ObjectMapper.java:3364) at org.ametys.core.util.JSONUtils.convertObjectToJson(JSONUtils.java:209) at org.ametys.core.cocoon.JSonReader.generate(JSonReader.java:61)
The waited error is in the logs :
Caused by: org.ametys.runtime.model.exception.UndefinedItemPathException: Unable to retrieve the model item at path 'toto'. This path is not defined by the model.
at org.ametys.runtime.model.ModelHelper.getModelItem(ModelHelper.java:118)
at org.ametys.runtime.model.AbstractViewParser._getModelItem(AbstractViewParser.java:392)
... 118 more