# Files with foreign content – hiccups in The Archive?

I have been using The Archive for almost half a year and it's great, in general. But there is one issue that worries me: I noticed – more than once – that some files lose their content and do have the content of other files. It happens on saving, I surmise, but I cannot confirm that yet, because so far I have always recognized it later only. Then I wonder why the filename and the title do not match anymore. Luckily, I use git and commit my whole zettelkasten daily, so it's easy to revert. Still, it's disquieting somehow and should be fixed, I guess.

Has anyone here already noticed the same problem?

• @ralfzosel said:

Has anyone here already noticed the same problem?

This is the first time I have heard of this problem (I've been reading the forum regularly for a couple of years). And I've never run into it myself. I run The Archive on a MacBook Pro and store my ZK files in Dropbox.

I suggest you attempt to describe in more detail the situation where this occurs, to help @ctietze try to understand it. If it's something you can replicate, even better.

Like you, my ZK files are backed up in several ways, so that I can always restore a previous version - a good idea for any / all of our data. The other day I tried updating Windows that was running in a virtual machine on my Mac, and the update just trashed the entire Windows virtual file (why am I not surprised?). Thank goodness for regular Time Machine backups.

• @GeoEng51 said:
I suggest you attempt to describe in more detail the situation where this occurs (…)

I will definitely do this as soon as the issue occurs next time.

In theory, it's also possible that's not a problem with The Archive, but with something else (e.g. the MarkDown iPhone app or even iCloud itself). I will keep an eye on this.

• That's a serious problem, sorry to hear you have to be on your toes now, @ralfzosel!

It's asking a bit much of a user, but since you're so well-equipped, you could help a lot figuring out if The Archive is the culprit, and how to fix this:

Could you check your git diffs every now and then to see if anything drastic stands out? (Likely full file replacements)

If so, please use "Help ▶ Send Log Files"; I only need to see the log for the day that matches an overwrite event, and the file name of the file that was overwritten (and maybe the filename it should've went into, if possible).

That'd help tremendously to narrow down what happened!

Author at Zettelkasten.de • https://christiantietze.de/

• OK, I added a function to the script that checks the "health" of my zettelkasten. Now it also tests if the UID of the filename occurs in the title. So I will recognise if the whole content of a file has been replaced.

As soon as such a case happens again, I will send you the log file.

• After almost 2 months now, the problem did not occur anymore. I did not use anything other than The Archive in that time, so I suppose something else caused this confusion before.

• The problem has reappeared, but – good news – now we are able to reproduce it:

I have two zettels:

On the second zettel, I put apostrophes around one word (to mark it as "code"):

On that zettel, I click the link that leads to the first zettel. There, I put apostrophes around one word as well:

Now, I click the link on that zettel which brings me back to the second card and now – big surprise – this second card contains the content from the first card:

As we have pinpointed this bug now, you should be able to fix it, hopefully. Besides that, I strongly recommend to everyone using git as often as possible to make sure no content gets lost by accident.

• I can report that with Version 1.7.9 (210), my system does not behave in this way. I get normal and expected switching between zettel when I reproduce your steps.

I have seen behavior a couple of times like this in the past, and I've chalked it up to me not fully clicking on the link. It is random. It also might be a timing thing.

How often is it occurring in your workflow?

Will Simpson
The quality of our thinking is directly proportional to the quality of our reading. To think better, we must read better. - Rohan
kestrelcreek.com

• My version is 1.7.7 (204) and it says it is "currently the newest version available". Where did you get this newer version from?

How often does this occur? Well, for about 2 months nothing happened. But then, I had this issue a couple of times within a few days. It depends on what I am using my zettelkasten for. When it comes to programming (which I have been doing a lot recently), I mark code more often and that increases the likelihood, I guess.

• I got a newer version today, 1.7.10 (213), from the cutting-edge release channel. I think it was released a couple of days ago.

Look at The Archive preferences to set up for the cutting-edge then "Check for Updates now" -

I can't be sure I've seen the behavior you describe. I might have seen something like what you describe two or three times in the last year. I also use my Zk as a coding reference but haven't noticed any correlation. You might be right, though.

I typically use a two window workflow that keeps the target zettel in focus.

Will Simpson
The quality of our thinking is directly proportional to the quality of our reading. To think better, we must read better. - Rohan
kestrelcreek.com

• @ralfzosel Thank you for the detailed report!

For context and reproducibility: I noticed that in your setup, you sort by modification date (the order of notes to the left changed), and you have an active search for the first note's title (the terms are highlighted), maybe by following the link.

I can't reproduce the behavior you describe either by clicking the links after adding the inline code styles.

That doesn't make me any more confident that it's not the app's fault; if anything, this reproduction problem makes it worse

Can you try with the latest version from the cutting edge channel as well? It's currently stable in my testing and will become the new stable release around the end of the week if nothing strange happens.

Author at Zettelkasten.de • https://christiantietze.de/

• I just installed version 1.7.10 (215) and the bug is still there. You are right, I sort by modification date and I clicked on the link.

But I found out something interesting: the bug only occurs if I first mark the word (in my example: "one" or "two") and hit then the apostrophe key (once). This makes two apostrophes with one key stroke, one in front and another after the word. If I do not mark the word and move instead the cursor to the position in front of the word and afterwards to the position behind the word, hitting the apostrophe key in total twice, the bug isn't there.

I am optimistic that these details will help you find the error.

• edited November 2022

@ralfzosel Thanks! Where do you store your notes? (E.g. in a cloud storage, or just on disk?) -- am asking because this can affect file operations slightly so I have the same environment

Author at Zettelkasten.de • https://christiantietze.de/

• I am using iCloud for that. It used to be a "regular" folder there. Three weeks ago, I stumbled upon 1Writer , so I switched to the folder ~/Library/Mobile\ Documents/9CR7T2DMDG~com~ngocluu~onewriter/Documents.

• Can you reproduce the error now? Can you fix it? I don't even dare to use apostrophes anymore.

• @ralfzosel I tried iCloud and other sync mechanisms and couldn't get it to reproduce 😕 I am investigating how to (1) make errors like this register in the app as errors, and (2) prevent these problems from happening where possible. (But I'm flying blind, that makes this very hard.)

If you can replicate this, please go through the motions you so nicely documented above again and send me the log files via the Help menu for that day + tell me which note you used the ` key in, and which was replaced (so I don't mis-interpret the logs)

Author at Zettelkasten.de • https://christiantietze.de/

• I can replicate the event with The Archive Version 1.7.7 (204). Note: On Mac OS (12.6), I have enabled "Use smart quotes and dashes" in "Keyboard" in System Preferences. When you type one aphostrophe, this creates a double apostrophe, placing the cursor inside the two. In this situation the event manifest.
If, on the other hand, I type a word and then insert an apostrophe at the beginning and one at the end, this does not cause the event.

Note: The Archive Directory is on my local hard disk, not on iCloud or Dropbox.

• @mrcmrc said:
I can replicate the event with The Archive Version 1.7.7 (204). Note: On Mac OS (12.6), I have enabled "Use smart quotes and dashes" in "Keyboard" in System Preferences.

That's actually good news that you can reproduce the issue. On my Mac, running Mac OS 13.0.1, "Use smart quotes and dashes" is not enabled.

Did you check out if the issue depends on that setting on your Mac?

• Odd: when I enable this option and also in The Archive, I can get smart apostrophes to work, but that also doesn't trigger the problem.

@mrcmrc Could you also send me the day's log after you made this happen with a short explanation what was supposed to go where?

Oh, do you have an Intel or M1 Mac?

Author at Zettelkasten.de • https://christiantietze.de/

• Oh, do you have an Intel or M1 Mac?

Mine has a 2,3 GHz 8-Core Intel Core i9.

• @mrcmrc Could you also send me the day's log after you made this happen with a short explanation what was supposed to go where?

I sent you the log file via email, strangely today I was unable to replicate the event...

Oh, do you have an Intel or M1 Mac?

On a Mac Studio, then M1.

• Pushed a small change to v1.7.10 (i.e. Release Candidate 4) earlier today that fixes the destructive behavior.

Author at Zettelkasten.de • https://christiantietze.de/

• Great! Thanks!