Read environment from cmt files with imports

Hello. I need to read environment from cmt file with third-party library imports. I need to get information about the constructors of some parameters of certain functions in this file.

let infos = Cmt_format.read_cmt path in
    infos.Cmt_format.cmt_annots
    |> function
    | Cmt_format.Implementation cmt ->
      Load_path.init infos.cmt_loadpath;
      let env = cmt.str_final_env in
      let env = Envaux.env_of_only_summary env in 
     ...

Everything works on files without imports, the code crashes on files with imports:

("Persistent_env.Error(_)")
+  Raised at Persistent_env.error in file "typing/persistent_env.ml", line 33, characters 16-33

Can you tell me what I can fix in this?

There were not enough recursive types.