oeysan / c2z

A Reference Manager in R
https://oeysan.github.io/c2z/
Other
9 stars 1 forks source link

bind_rows() error in reading library #3

Open sjgknight opened 11 months ago

sjgknight commented 11 months ago

Trying to do something with the library I previously accessed and now when I try and read it using the Zotero function I get an error... I'm not sure how to go about debugging this.

Zotero(user = F, id = group_id, silent = F, index = F, library = T)
Searching for collections 
Found 8 collections 
The Zotero list contains: 8 collections, 0 items, and 0 attachments 
Searching for all items in library 
Found 327 items 
Need 3 addtional queries to gather items 
Error in `dplyr::bind_rows()`:
! Can't combine `..1$relations$dc:replaces` <list> and `..2$relations$dc:replaces` <character>.
Run `rlang::last_trace()` to see where the error occurred.
> rlang::last_trace()
<error/vctrs_error_ptype2>
Error in `dplyr::bind_rows()`:
! Can't combine `..1$relations$dc:replaces` <list> and `..2$relations$dc:replaces` <character>.
---
Backtrace:
    x
 1. \-c2z::Zotero(user = F, id = group_id, silent = F, index = F, library = T)
 2.   \-c2z::ZoteroLibrary(...)
 3.     \-c2z::ZoteroGet(...)
 4.       \-c2z:::AddAppend(...)
 5.         +-dplyr::distinct(dplyr::bind_rows(old.data, data))
 6.         \-dplyr::bind_rows(old.data, data)
Run rlang::last_trace(drop = FALSE) to see 10 hidden frames.
> rlang::last_trace(drop = FALSE)
<error/vctrs_error_ptype2>
Error in `dplyr::bind_rows()`:
! Can't combine `..1$relations$dc:replaces` <list> and `..2$relations$dc:replaces` <character>.
---
Backtrace:
     x
  1. +-c2z::Zotero(user = F, id = group_id, silent = F, index = F, library = T)
  2. | \-c2z::ZoteroLibrary(...)
  3. |   \-c2z::ZoteroGet(...)
  4. |     \-c2z:::AddAppend(...)
  5. |       +-dplyr::distinct(dplyr::bind_rows(old.data, data))
  6. |       \-dplyr::bind_rows(old.data, data)
  7. |         \-vctrs::vec_rbind(!!!dots, .names_to = .id, .error_call = current_env())
  8. \-vctrs (local) `<fn>`()
  9.   \-vctrs::vec_default_ptype2(...)
 10.     +-base::withRestarts(...)
 11.     | \-base (local) withOneRestart(expr, restarts[[1L]])
 12.     |   \-base (local) doWithOneRestart(return(expr), restart)
 13.     \-vctrs::stop_incompatible_type(...)
 14.       \-vctrs:::stop_incompatible(...)
 15.         \-vctrs:::stop_vctrs(...)
 16.           \-rlang::abort(message, class = c(class, "vctrs_error"), ..., call = call)
oeysan commented 11 months ago

I could replicate the isse and it was due to an error in the formatting of the relations entry (which is not very thoroughly documented in the Zotero API). Hopefully, the latest commit should handle empty relations as well as merged and related entries.