The issue is very clear now. In "orbeon/builder/summary" when user click a form definition to edit (let say app='sales' form-name='car-sale') then Orbeon at some point call service:
Then (or before) Orbeon call the service again but this time with form-name = 'library' (i think to populate lateral menu section templates).
The persistence layer throw an Exception because that form does not exist (the 'library').
When anApplication does NOT have any library/template what is the proper answer ?
(an empty form definition ?)
Our custom persistence layer has always returned a 404 Not Found error for this and other cases where a template or form is not found. That has worked fine for us up to version 2016.2. As it is a REST call this seems to me to be the correct response when something is missing.