Can no longer set variables!

Something very odd is happening - I can no longer set variables in many cases. I first thought it was an issue with just the 'Prompt for User Input' and discussed it in this thread. However, I've since discovered that I have another macro whose 'Set Variable to Calculation' action is not producing a result either.

Here's a screen recording showing me creating a brand new macro, adding 'Prompt User', running the action and showing that no variable is stored.
KBM

Note that these issues have impacted macros that I have been running for years and haven't edited recently. I am running KM 11.0.3 on Mac OS 14.5. Troubleshooting steps taken so far:

  1. Restart KM engine
  2. Reboot Mac
  3. Reboot Mac in safe mode
  4. Downgrade to version 11.0.2 (have moved back to 11.0.3 since)

Your screen recording is working as expected. You aren't setting any variables in your prompt action. "Hello" will show up if you use the %PromptButton% token later in the macro, but hitting "Goodbye" will immediately cancel the macro.

I read your other thread, and there does seem to be something funky happening there. But at least in this particular test macro, i don't see anything wrong.

1 Like

Ah, thanks - this was clearly a bad example, but I am most definitely having issues with variables being created. It's a new issue. I've been using KM for years and have many macros that prompt for user input and never encountered such a problem. Here's another example:
KBM

You can see that the debugger doesn't 'register' the variables, nor do they appear in the notification.

Have you checked the Keyboard Maestro Engine logs? Something is clearly wrong.

1 Like

Agreed. Having very odd behaviour seemingly out-of-nowhere. I will mention that this seems to have started after my Mac seems to have crashed while sleeping (as indicated by it booting up when I opened the lid).

I just checked the logs and am seeing some very suspicious stuff. My username is redacted:

2024-08-12 14:37:52 Execute macro “test” from trigger Editor
2024-08-12 14:37:54 FMDB Error: Unknown error calling sqlite3_step
2024-08-12 14:37:54 FMDB Error: executeUpdate sqlite3_step returned  (11: database disk image is malformed)
2024-08-12 14:37:54 FMDB Query: DELETE FROM variables WHERE name = ?
2024-08-12 14:37:54 FMDB Path: /Users/myname/Library/Application Support/Keyboard Maestro/Keyboard Maestro Variables.sqlite
2024-08-12 14:37:54 FMDB Error: Unknown error finalizing or resetting statement calling sqlite3_finalize
2024-08-12 14:37:54 FMDB Error: executeUpdate sqlite3_finalize returned  (11: database disk image is malformed)
2024-08-12 14:37:54 FMDB Query: DELETE FROM variables WHERE name = ?
2024-08-12 14:37:54 FMDB Path: /Users/myname/Library/Application Support/Keyboard Maestro/Keyboard Maestro Variables.sqlite
2024-08-12 14:37:54 Assertion Failed: ([gDatabase executeUpdate:@"DELETE FROM variables WHERE name = ?" , variable]),  file: …/Source/Defines/KMVariables.mm:649, value: 0
2024-08-12 14:37:54 FMMDB error 11: database disk image is malformed
2024-08-12 14:37:54 FMDB Error: Unknown error calling sqlite3_step
2024-08-12 14:37:54 FMDB Error: executeUpdate sqlite3_step returned  (11: database disk image is malformed)
2024-08-12 14:37:54 FMDB Query: UPDATE changes SET count = (count % 1000000) + 1 WHERE name = ?
2024-08-12 14:37:54 FMDB Path: /Users/myname/Library/Application Support/Keyboard Maestro/Keyboard Maestro Variables.sqlite
2024-08-12 14:37:54 FMDB Error: Unknown error finalizing or resetting statement calling sqlite3_finalize
2024-08-12 14:37:54 FMDB Error: executeUpdate sqlite3_finalize returned  (11: database disk image is malformed)
2024-08-12 14:37:54 FMDB Query: UPDATE changes SET count = (count % 1000000) + 1 WHERE name = ?
2024-08-12 14:37:54 FMDB Path: /Users/myname/Library/Application Support/Keyboard Maestro/Keyboard Maestro Variables.sqlite
2024-08-12 14:37:54 Assertion Failed: ([gDatabase executeUpdate:@"UPDATE changes SET count = (count % 1000000) + 1 WHERE name = ?" , from]),  file: …/Source/Defines/KMVariables.mm:395, value: 0
2024-08-12 14:37:54 FMMDB error 11: database disk image is malformed
2024-08-12 14:37:54 FMDB Error: Unknown error calling sqlite3_step
2024-08-12 14:37:54 FMDB Error: executeUpdate sqlite3_step returned  (11: database disk image is malformed)
2024-08-12 14:37:54 FMDB Query: commit transaction
2024-08-12 14:37:54 FMDB Path: /Users/myname/Library/Application Support/Keyboard Maestro/Keyboard Maestro Variables.sqlite
2024-08-12 14:37:54 FMDB Error: Unknown error finalizing or resetting statement calling sqlite3_finalize
2024-08-12 14:37:54 FMDB Error: executeUpdate sqlite3_finalize returned  (11: database disk image is malformed)
2024-08-12 14:37:54 FMDB Query: commit transaction
2024-08-12 14:37:54 FMDB Path: /Users/myname/Library/Application Support/Keyboard Maestro/Keyboard Maestro Variables.sqlite
2024-08-12 14:37:54 Assertion Failed: ([gDatabase commit]),  file: …/Source/Defines/KMVariables.mm:396, value: 0
2024-08-12 14:37:54 FMMDB error 11: database disk image is malformed

SOLVED! Googling 'Keyboard Maestro error calling sqlite' returned this thread: Cannot Set Variable Value - #2 by noisneil

I deleted the .sqlite file and now everything is working. Thanks for prompting me to look at the logs.

2 Likes

Looks like your Keyboard maestro Variable database is corrupted. I'd back up your macros, do a full uninstall of keyboard maestro and re-install.

Alternatively you could try quitting the Keyboard maestro engine, deleting the Application Support/Keyboard Maestro folder, and restarting it and see if it generates a fresh database.

That was exactly it. I posted just above you mentioning that this has been solved by trashing 'Keyboard Maestro Variables.sqlite'.

1 Like