My BTT setup has gotten into a seemingly irrecoverable bad state. What are my best options to get it working again?

Hi there,

I am a long-term user of BTT and it's one of the first apps I install on a new machine. I don't know what I would do without it. And hence, when it is not working for a protracted period, it really affects my daily workflow very badly indeed.

Okay, so what has actually happened? Well this is the problem, and this is why I have not posted this post in the bugs category/forum. I simply do not know at what point or what action caused BTT's behaviour to degrade to the level it is at today. It was like a slow degradation somehow. Anyway, I'll start by defining the main problem that I am experiencing:

When I create a new keyboard shortcut (i.e. :⌘4), and then use it, I get the Mac's default "Bing!"error sound, indicating that the shortcut I just used is not applicable in the current app or context. If I switch out of BTT and try the shortcut, the same thing happens. if I disable the shortcut, I do not hear the Bing.

And this is where things get even weirder. If I delete the Shortcut or move the shortcut to a different profile or even if I delete the shortcut and then create it again, it sometimes begins to work. Sometimes disabling and then enabling various profiles addresses the problem. And if I remember correctly, sometimes restarting the app resolves the problem. I'm an ex software developer, and an experienced one at that, and yet my Spidey sense has failed to track down what the exact parameters or context necessary for triggering this bug are/is.

My gut tells me that at some point, something was saved to my BTT config/preferences which BTT now no longer handles correctly. But unfortunately, I do not have dated backup files, I have just been using the experimental Dropbox backup feature and so I [presumably] can't restore an older version of my config that works. And even if I could, I would lose months potentially of changes and new shortcuts -_-

And hence I am at a loss, and hence, this post. I would really, really appreciate some help in either fixing this outright, debugging it, narrowing down where the issue is, anything that will get BTT working properly again.

Oh, I don't know if it if this is related but deleted shortcuts are like zombies in BTT now LOL. I'll delete a Shortcuts and then create a new shortcut with the same key binding and then some period later when I'm using this shortcut, BTT pops up that little contextual menu asking which of the two key bindings I want to use! And when I go to the "recently used" Filter on the left-hand side menu, it says the one I just used is in the trash! And if I delete it from the trash, a few days or hours or some random period later, it will come back again! I'm guessing that this is unrelated, but I thought I would mention it in case it is. I'm actually experiencing at least three or four other pretty bad bugs but this post is already far, far too long. If folks want to hear them, I will supply them in comments.

Congratulations and many thanks for reading this far, you are a true BTT hardcore user LOL. Any and all help is most appreciated.

Cheers,
Pete

Most likely the experimental Dropbox/iCloud sync corrupted your BTT's database.
Unfortunately If you don't have backups there is not very much you can do (that's why I do have the big red warning about the sync)

BTT does create auto-backups on every version upgrade and keeps them for a few versions in ~/Library/Application Support/BetterTouchTool, these could be restored (if you disable the sync first). However you mentioned it happened slowly, so I'd assume the backups already have some corruption as well. Do you know approximately when it started happening?

Hi Andreas,

Giant :frowning: . If I’ve lost big chunks of work, I’m going to be extremely pissed off if I’m being honest. Not at you, or BTT, but at the loss of effort, which constitutes many, many hours of work, and at my poor decision to rely on something clearly marked as experimental.

Anyway, all might not be lost just yet. I will check out those files and see what can be recovered.

Just BTW, I restarted BTT to try and fix the issue I’ve been encountering and a folder with multiple subfolders of keyboard shortcuts (probably ~100 shortcuts in total) is just not there any more. Gone. Would that be consistent with the DB getting corrupted?

BTW are there any logs, or the DB itself that I could share or poke around in myself to see if I can spot anything obvious?

Thanks for the prompt reply,

Peter

Yes it all sounds like some hard corruption. Unfortunately logs won't help in this case.

I would try to create a backup of ~/Library/Application Support/BetterTouchTool (go there via Finder => Go => Go to Folder, make sure to include the ~), then disable the experimental sync and then try to restore some recent auto-backups. Maybe you can find one that still contains your changes and isn't broken?

Exporting your preset(s) and importing them into a fresh database (that is not synced) could also help (basically deleting ~/Library/Application Support/BetterTouchTool to start fresh, then import the presets)

1 Like

Hi agan,

A couple of immediate questions:

  1. Where are the backups you mentioned? There’s a Backups directory but it containds just 1 file from 2022…
  2. Where in Dropbox is the auto-backup dir? Is it ~/Dropbox/Apps/BetterTouchTool/MainStore.v2? If so, is it from the “Ensembles” framework? Actually, I think my real question is: how to I view the different backups, or is there only the one?

Oh yeah - I said that that large folder with 100 shortcuts just vanished right? Well I actually saw the Trash folder for the first time, was filled with relief and just emptied it by selecting all and CMD-delete. I am now thinking that for some reason, that deleted my not-trashed large folder of shortcuts :frowning:

Peter

They are all stored directly in ~/Library/Application Support/BetterTouchTool (so if you maybe have time machine or similar backup solutions, you could also restore that full folder to previous versions). Just make sure to create a backup of ~/Library/Application Support/BetterTouchTool before trying anything.

The dropbox / ensembles folder won't help as it just contains the incremental changes.

I'm going to sleep now, you could also zip up that ~/Library/Application Support/BetterTouchTool folder and send it to me (andreas@folivora.ai) then I can check tomorrow whether I can see anything obvious.

1 Like

Got it. As it happens I lucked out as my weekly Time Machine backup was this morning :hot_face:

I’ll follow your instructions and report back.

Cheers

Hi Andreas,

a quick update for you since you’ll be up before me (probably), and it’s concerning - at least from my point of view and I’m hoping that it’s not concerning from yours!

Please watch the linked screen recording (I could not attach, the upload was too slow): I cannot modify or create keymappings at all. Please help with that (obviously lol).

In terms of recovering my painstaking, beloved config, the best I could do was to grab a the most recent profile (which is months old) on disk :

mdfind -name "bttpreset" -0 | xargs -0 gls -l --time-style="+%Y-%m-%d" | awk '{print $6,$7}' | sort -n

and import it. This is somewhat helpful but I still feel super shitty that I’ve lost so many hours of work -_- What a dummy.

Oh yeah! I’m having bizarre trouble with Time Machine of all things! In essence, all of the proceeding dates - when I open the Time Machine app - are grayed out!?! I've googled around for this but none of the other Q&A’s seem to apply. If I could get my hands on that snapshot, then I would essentially have lost no work at all. So that's where I'm gonna be spending my time.

Do let me know if my config or this video turn up something interesting please.

Thanks again for your help,

Peter

HURRAH!

That did the job :right_facing_fist:t2: There was a backup from ~ a week ago which I restored and I'm pretty much back to where I was! I don't know if the weirdness like that in the screen recording I posted is still going to happen or not, but at least I've got my work back if you know what I mean. So, for now, I think we can consider this post resolved and if the weirdness I observed continues, I will create a new post about resolving that.

Thanks again for your help, I was extremely worried about all that work. And from now on, I am backing it up myself LOL :+1:

Cheers,

Pete

Oh – just for reference and future readers of this post who experience problems with their Time Machine and restoring the BTT library folder, the reason that my backups were grayed out was because I had added ~/Library to the list of directories not to back up because I figured it was mostly just static things. Obviously in retrospect, I was wrong and this was a terrible idea.

So if you also have added that to your list directories not to back up, you may want to think about addressing that :slight_smile:

Cheers,

Peter

Hi Andreas,

I'm resurrecting this post because I'm still having issues unfortunately. I am now mostly able to modify existing triggers by cutting them and pasting them back in, which is something at least. And I have recovered pretty much all of my lost work which is fantastic.

However, I am still left with a corrupt config, the exact definition of “corrupt”, I'm sure that you are clear on, but I am not LOL. So my question is as follows:

TL;DR: how do I go about obtaining an uncorrupted conflict from my corrupt config?

Being a veteran software developer myself, I would imagine that the way to do it would be to decompose the problem first of all. Sometimes that is all that's required as it helps you locate perhaps the one or two corrupt triggers or bindings or files or whatever and you are all set.

If nothing overt is revealed, the next step would be to probably create a second “instance” of BTT, or set up my application support folder such that I can easily switch between the corrupt one and the new config that I'm rebuilding. Maybe even use a container or something if I'm feeling brave.

Then it would be a case of basically moving chunks of the corrupt config over to the new config or something? I'm sorry, I'm not being very clear here, maybe because I don't have a good picture in my mind as to how best to do this. So, in essence, if this had happened to you, how would you go about building a good config from your corrupted config?

Cheers,

Peter

I would try these steps:

1.) Make sure dropbox/icloud sync is disabled
2.) Export your current presets to a file.
3.) Create a backup of ~/Library/Application Support/BetterTouchTool (or use Help => Export FULL BetterTouchTool Backup As Zip File if you are on the current BTT alpha)
4.) Quit BTT
5.) Delete or rename ~/Library/Application Support/BetterTouchTool
6.) Starting BTT now you will have a completely empty, clean database. Now import the presets again (when importing the preset JSON BTT has various safety checks to prevent re-corrupting)