Drag-drop from My Library to Group fails for some items

Periodically, I drag-drop items from My Library to a group. But sometimes, some of the items will not get copied over. I tried to troubleshoot this and notice that one of the items will not only not copy over, but also cause another item to pop-up in the Collection to which I am copying. Example:

I am trying to drag-drop item FUGES46D from My Library to a collection in a group and each time it produces item H2N3K2GE (already present in another collection in the same group) to show-up in the target collection, while the intended item does not get copied over at all.
Title: CARB approves heavy-duty OBD amendments, adopts REAL NOx & CO2 tracking
Type: Report
MyLib: zotero://select/library/items/FUGES46D
Group: Shows up as zotero://select/groups/310273/items/H2N3K2GE

The item that shows up is:
California ARB adopting approval procedure for aftermarket DPFs
Type: Webpage
MyLib: zotero://select/library/items/R39ZFWKH
Group: zotero://select/groups/310273/items/H2N3K2GE

What might be causing this?
  • That's bizarre — somehow both of those items in your personal library are linked to the same item in the group. I don't think we've ever seen that before, and I'm not sure how it would've happened, though we can keep an eye out. I think you can fix it by deleting the item in the group and emptying the trash, and then dragging both items again.
  • Thanks, good to know why this is happening. I may have 15-20 such items that refuse to get copied over when I drag-drop. I found the given example from a item by item comparison in what should be two identical collections (one in MyLib, other in the group).

    How can I identify all the cases? Can you or I run some code that finds the many-to-one association cases? Or some way to show me which items are missing in the collection in the group? Trying to find all of them manually, while possible, is going to be very labor intensive.
  • edited May 12, 2020
    You can paste this in Tools → Developer → Run JavaScript to see all the items linked to more than one item in another library:

    var getSelectURI = (item) => {
    let uri = Zotero.URI.getItemURI(item);
    uri = uri.replace('http://zotero.org/', 'zotero://select/');
    uri = uri.replace(/users\/\d+/, 'library');
    return uri;
    };

    var rows = await Zotero.DB.queryAsync(
    "SELECT object, GROUP_CONCAT(itemID) AS itemIDs FROM items "
    + "JOIN itemRelations USING (itemID) "
    + "WHERE predicateID=(SELECT predicateID FROM relationPredicates WHERE predicate='owl:sameAs') "
    + "GROUP BY object HAVING COUNT(*) > 1"
    );
    var str = "";
    for (let row of rows) {
    let item = await Zotero.URI.getURIItem(row.object);
    if (!item) continue;
    await item.loadAllData();
    str += "===============================\n";
    str += item.getDisplayTitle() + "\n" + getSelectURI(item) + "\n\nLinked Items:\n\n";
    let itemIDs = row.itemIDs.split(",");
    for (let itemID of itemIDs) {
    let item = await Zotero.Items.getAsync(parseInt(itemID));
    await item.loadAllData();
    str += item.getDisplayTitle() + "\n" + getSelectURI(item) + "\n" + item.dateAdded + "\n\n";
    }
    str += "================================\n";
    }
    return str;


    If you have any thoughts on how the resulting items might be related (added at the same time? copied at the same time?), let us know.
  • Thanks, that's very helpful. I ran the code and the results are in:
    https://1drv.ms/w/s!Atcr8aCyjBrulaNNraeQsAAPp_pzIQ?e=tnbNHz

    From looking at the items, I think the issue is caused for items that were created by using the 'Duplicate Item' feature. I use that when the item I am creating has many fields identical to an existing item (such as conference name, date, location). Is that the wrong way to use it?

    In the report I linked above, the blue colored items are in the Group library. So, I will delete those from the Group Library and then drag-drop the items linked to that in My Library. I tried this for the items on page 1 and it seemed to have worked.
  • Ah, that would do it — thanks.

    In the latest Zotero beta, and for 5.0.86, I've updated it to not include cross-library linked items or merged-item links when duplicating items. Only related-item links will be kept, which are visible in the UI and can be removed if unwanted (but would often remain relevant even if the item was edited to point to represent a different source).

    There's not much we can do to automatically fix existing entries for people who ended up in this situation, but we're hoping to make some UI improvements to cross-library dragging to give better visibility into and control over these connections.
  • Thanks. For my understanding, in the current version of Zotero (5.0.85) the cross-library links and merge-item links from the original item are copied over to the new item created using Duplicate Item feature. Thus, when I try to drag-drop this new item to a group (that already has the original item), it does not work because the new item is considered same as the original item. I am glad to know the cause and happy to fix the existing issues manually. The code identifying which items I need to fix makes it much easier.

    1. Do I need to worry that the items created using Duplicate Items have carry over cross-library links and merged-item links from the original item? Can this cause other issues in future?

    2. What was the intent of the Duplicate Item feature in the first place and am I using it in the wrong way? I use it to create a new item with many fields pre-filled to avoid manual entry. Obviously, I do not use it when the Connector will grab the metadata for me.

    Related but different issue (just to mention it here): Some way to sync the metadata of items common to My Library and Groups would be super helpful.
  • 1. Do I need to worry that the items created using Duplicate Items have carry over cross-library links and merged-item links from the original item? Can this cause other issues in future?
    If you delete the copied items from the group library and empty the trash, that will clear any relations pointing to them in the original library.

    If the original item A was the result of a merge with item B, and A was duplicated to C, incorrectly duplicated merged-item relations on C could theoretically cause citations in word processor documents that used to point to item B to update to point to C instead of A. The same query above with dc:replaces might work, though I haven't thought through it.
    2. What was the intent of the Duplicate Item feature in the first place and am I using it in the wrong way? I use it to create a new item with many fields pre-filled to avoid manual entry.
    It's most commonly used for book chapters, but any use is fine. Including non-related-items relations was just an oversight on our part.
  • Using the script results as shown in the Word file, I deleted the items from the Group library (11 items) and successfully copied the items from My Library (37 items).

    In general, I check if there are duplicates after a session where I have added many new items. And if there are new duplicates, I merge them such that the older item is preserved. I do this so as not to break any past citations. It seems that would prevent the kind of issue described in the A, B, C example.
Sign In or Register to comment.