iOS Shortcut creates documents that never sync—why?

Preliminary preparations

MacOS version: Ventura 13.4
DEVONthink version on the Mac: 3.9.2
DEVONthink To Go on my iPhone: 3.7.4 (17370)

Before I describe the shortcut and the problem, let me first describe how I made sure that my Inbox in DTTG on my iPhone and in DEVONthink Pro on my Mac were both clean, synchronized, and (apparently) free of issues.

  1. Force-quit DTTG on my phone to make sure it didn’t sync while I did the next few steps
  2. Back on the Mac, quit and restarted DEVONthink.
  3. Removed all files from the DEVONthink Inbox:
  4. Emptied the DEVONthink Trash on the Mac and checked that there was nothing in it.
  5. Used File ▹ Verify and Repair Database followed by File ▹ Check File Integrity on the Inbox in DEVONthink on the Mac and made sure there are no issues in the log:
  6. In the Preferences for DEVONthink on the Mac, in the Sync tab, selected Inbox and ran “Clean Database…”:
  7. Since the previous step deselected the Inbox from the list of Databases being synchronized, I then reselected the checkbox for Inbox, and let DEVONthink sit for several minutes to make sure all the databases were sync’ed to the sync store.
  8. Back on the phone, restarted DTTG, let it sync for many minutes, made sure the Inbox was empty and there were no warnings in the sync log. For good measure, I tapped on the “cloud” icon in the bottom row to make it sync a couple more times. There were no sync warnings, no errors – everything looked peachy. I verified that the sync location panel showed that the toggle for the Inbox location was on, and that all the databases synchronized in the last minute.

Now, the actual problem

I made a simple iOS shortcut to create quick short notes in DEVONthink:

The purpose is simple: ask me for some text, then create a markdown document with that text as the title of the document prepended with the string “@log”. (The document has no body created here and that’s okay – I create title-only md documents on the Mac on a daily basis and it is never a problem.)

I ran the Shortcut from the Shortcut app. It prompted me for the text, as expected. I typed some text,

and clicked Done, and it ran apparently without any problems or warnings. Great! I switched back to DTTG, and saw that the Inboxes showed a count of 1:

I tapped on “Inboxes” and found my newly created document, as hoped:

I tapped on the document and DTTG said it didn’t have a body, just as expected:

I let DTTG and DT on my Mac sync for a good long while. Came back to the Mac, and … hmmm … uh-oh. While the document existed, it had a cloud-with-downarrow icon next to it:

I looked in the log, and it’s showing as “File still pending”:

I went back to DTTG on my phone, and it is showing “Missing file”:

I cleared the logs, force-quit DTTG, restarted it, tapped the cloud icon to make it sync, let it sync, waited, made it sync again. Now a new warning showed up in the sync log:

And that’s where things are stuck now:

  1. I can see a document in both DTTG and DT
  2. DTTG seems to think it still needs to upload a document to the sync store, yet something by that name does exist there, and I can see it in DT on the Mac
  3. DT on the Mac says that the document remains to be downloaded

This behavior of the Shortcut is also 100% consistent and repeatable: every document it creates looks like it synchronizes to DT on the Mac, yet suffers from this “file still pending”/“left to be uploaded” problem. At the same time, no other kinds of documents have this problem. Everything is otherwise sync’ing perfectly – documents that I add to databases on my Mac show up on my iPhone; documents I add or create on my iPhone show up on my Mac. As far as I can tell, only the documents created by the Shortcut have this peculiar problem.

What is happening? Am I missing some step in the Shortcut that would make it create a document in a different and more correct fashion in DTTG? Or is it a bug in the DTTG “Create” action for Shortcuts on iOS? Does this problem happen to other people? How do I fix whatever the problem is, and make the Shortcut work?

Additional notes

  1. I’m not new at debugging issues, so rest assured that I didn’t experience this problem just once. I’ve been struggling with this issue for days. I recreated the Shortcut to make sure some glitch didn’t occur, I verified all my databases, quit DTTG and DT multiple times, generally tried to make sure things are free of sync issues, etc. – basically tried everything I could think of. The description in this posting was done this morning by doing every step to reproduce the problem yet again, and make screenshots along the way.

  2. One of the screenshots of the DTTG sync log above shows a “Synchronization” error 4099. This is not typical; I don’t think I’ve ever seen it before, and I think it’s extraneous to the whatever is really happening. Certainly it’s the case that in past days while trying to figure out what’s happening, I never saw this error. I’ve included it in the screenshot here because I didn’t want to take the time to redo all the steps to get to the point of being able to show the log at that particular moment in the sequence. The DEVONthink developers may recognize this error (I don’t), which is another reason I’m leaving it in, but again, I emphasize that (to the best of my recollection) this is the first time I’ve seen this particular error in the logs. Logically, since the “missing file” problem has been occurring consistently for this Shortcut but the error 4099 has not, it argues that some other problem or error is the root cause. (However, we can’t discount the possibility that it could be an interaction between the two, i.e., between the sync method and empty documents.)

  3. In the past couple of weeks, I’ve also been seeing the familiar CloudKit “CKErrorDomain 15” error on the Mac. It is tempting to ascribe the Shortcut problem to this sync issue, but I’m not convinced this is the cause. First, DEVONthink is synchronizing something – the document created on my iPhone is showing up in DEVONthink on my Mac. Second, other documents sync fine. Third, based on all the symptoms, the problem seems more likely to involve something about the nature of the document being created by the Shortcut and less about the nature of the sync method.

Updates

  • 2023-08-26 (later this morning) I had the bright idea of using the Shortcut to create a document, but then quickly switching to DTTG and editing the new document to put some text into the body, before DTTG tried to sync it. Lo and behold: this document does not suffer from the “missing file”/“still to be downloaded” problem. It sync’ed to DEVONthink on the Mac and there it looks like a normal document. This implies to me that the issue is with empty documents, or possibly a problem in the way that the DTTG “Create” action for iOS Shortcuts creates the documents it creates.

  • To test another possibility, I went into DTTG in the Inbox group, and used the button to create a new document in the group, but giving it only a name and no body. In DTTG, the result looks very much like the documents created by the Shortcut: when you view the document, DTTG flashes a message that “This Markdown document contains only metadata”. Giving DTTG time to sync, no errors appear in the DTTG logs, and the document appears in my Mac DEVONthink Inbox group normally, without the cloud-with-downarrow icon and no error in the log. So I went back to the Shortcut on the iPhone one more time, and again created a document that way, let things sync, looked at it on the Mac, and … it has the cloud-with-downarrow icon.

So at this point, I am convinced the problem centers on the “Create” action on iOS.

Quick question: Why are you using CloudKit and have you tried a Bonjour sync instead.

I haven’t tried Bonjour recently. I need a cloud-based synchronization method so that I can synchronize when I’m away from home. With Bonjour, I could only sync when I’m at home, and since I have multiple devices, making sure that everything is sync’ed before I leave home is just not feasible, especially if I have to leave suddenly.

As mentioned above, all other documents sync fine. Even despite the CloudKit warnings in the logs, I have no problems with accessing other documents. The fact that (so far) the only documents affected are the ones being created by the Shortcut makes me think that the sync method is not the problem.

To be fair, I have to acknowledge that we can’t discount the possibility the problem is still fundamentally something due to CloudKit.

1 Like

I’m not sure if this is a sync or Shortcuts issue but I believe it stems from your lack of content. It’s syncing as if it’s shallowly synced. But…

  1. The file is empty but accessible in the originating database.
  2. I am syncing via Bonjour and file is being received on the server device.
  3. The database on both devices is set to Download Files: Always, never a shallow sync.
  4. I didn’t use the Global Inbox to make sure it’s not specific to the Inbox. Remember the Inbox is handled a bit differently than other databases.

Adding a space or a single character to the content and the document works as expected here.

This is also an issue that happened three years ago. I have reopened the issue and am referencing this thread. Thanks for your patience and understanding.

PS: I wouldn’t use an @ or other such punctuation in a filename. Something to consider, and yes, I’m aware of your background. :slight_smile:

I have the same for #3 (download always).

Your #4 gave me an idea to test: I changed the Shortcut to use a different destination instead of the global Inbox. I used a folder/group in another database. When the empty document sync’ed to the Mac, once again it showed as pending download on the Mac and an error about “Missing file” in the sync log on DTTG. So, it seems to be unrelated to the use of the Inbox.

OK, I tested removing the @ from the document name being generated. I modified the Shortcut appropriately (and left the destination as another database, not the Inbox) and ran the test again. Once again, the same: on the Mac it has the cloud-with-downarrow icon after it syncs.

Is there a way to have the Create action in Shortcuts also add a body to the document? Or perhaps another action that will add content to an existing document?

When I expand the options for DTTG’s Create action in Shortcuts, I don’t see a way to add content. (A comment, yes, but not a document body): I am an idiot. There’s an input field for body text right there, in the area where it shows the word “Markdown” in faint gray (which at first I took to be just information about the type of document being created – it is not obvious that this is an input field where you can type something):

Putting some text in there made the problem stop happening. The document syncs normally.

So, this solves my immediate problem of getting this to work. I just need to put some kind of dummy text in there.

Note: I discovered that if the content you try to put in is a space (just to have something in there) or a newline, the Shortcut will fail on execution with an error about “failed to communicate with app”.

1 Like

That’s interesting. That was an old symptom, However, I am not seeing the pending file appear in DT3.

Putting some text in there made the problem stop happening. The document sync’s normally.

As expected so thanks for the confirmation. :slight_smile:

2 Likes

To avoid the issue, the next version will add boilerplate text of (Text) or (Markdown) when no body content is specified.

1 Like