When querying an empty dataset that is empty with a sort order, for example:
query = datastore.Query(kind='Book', order='title')
it = query.fetch(limit=limit, start_cursor=cursor)
entities, more_results, cursor = it.next_page()
It raises an exception:
PreconditionFailed: 412 no matching index found.
Once you create an entity in the dataset, the error disappears. It reappears when you delete all entities.
gcloud-node doesn't suffer from the same problem, as this just returns an empty array for an empty dataset:
var q = ds.createQuery([kind])
.limit(limit)
.order('title')
.start(token);