Strange error in groupped_by function


I got some strange error when I group results. This is probably not due to the consistency of my current database. But I think that even in this case, my code should not cause panic.

// Code
let posts = posts::table.load(&connection)?;
let users_and_posts: Vec<Vec<models::User>> = users::table
// Error
    9: <core::option::Option<T>>::expect
                 at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/src/libcore/
      10: <std::collections::hash::map::HashMap<K, V, S> as core::ops::index::Index<&'a Q>>::index
                 at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/src/libstd/collections/hash/
      11: <Iter as diesel::associations::belongs_to::GroupedBy<'a, Parent>>::grouped_by::{{closure}}
                 at /home/user/.cargo/registry/src/
      12: <core::option::Option<T>>::map
                 at /rustc/2aa4c46cfdd726e97360c2734835aa3515e8c858/src/libcore/
      13: <Iter as diesel::associations::belongs_to::GroupedBy<'a, Parent>>::grouped_by
                 at /home/user/.cargo/registry/src/

Is there any idea how I can fix this?

From looking at the code that causes this panic it seems like your parents (== posts) don’t contain an entity with a id given by your childs (== users).
Without any additional code like your schema definition or the corresponding queryable structs it is quite hard to answer this with more details.