"statementinvalid" after some number of posts

Posted under Bugs & Features

after browsing ran into error at specific page 270:
https://danbooru.donmai.us/posts?page=270&tags=order%3Ascore+limit%3A100+

    ActiveRecord::StatementInvalid exception raised
    app/logical/post_query_builder.rb:173:in `paginated_posts'
    app/logical/post_query.rb:86:in `paginated_posts'
    app/logical/post_sets/post.rb:109:in `posts'
    app/controllers/posts_controller.rb:24:in `index'
    app/logical/rack_server_timing.rb:19:in `call'

whereas page 260 is fine
https://danbooru.donmai.us/posts?page=260&tags=order%3Ascore+limit%3A100+

if you change per-page limit, the error occurs at the same total post count. Further filtering by date delays the problem, but it still exists.

does not seem to be random, always fails, occurs both on api and browser, and does not look like database timeout. Bug or user error?

1