AutoHotKey v2.0.11 has a PCRE execution error Topic is solved

Report problems with documented functionality
User avatar
Ross
Posts: 100
Joined: 13 Mar 2016, 00:27

AutoHotKey v2.0.11 has a PCRE execution error

15 Feb 2024, 17:10

I had AutoHotKey v2.0.9 installed. At some point I needed to reinstall AutoHotKey v1 to run a particular script I came across. After that, I got the firstly useful, then annoying prompt asking me which version of AHK to run. I tried removing manually the v1 folder from Program Files\AutoHotKey, but to no avail; the v1 executable wasn't there, but the system still registered it as installed. So I went ahead and uninstalled AutoHotKey completely, then downloaded the current version (2.0.11 as I post).

After installing 2.0.11, it displays the Dash suggesting it was properly installed, but then I get this on one of my ever-running scripts:

Code: Select all

Error: PCRE execution error.

Specifically: -8

    ---- C:\Program Files\AutoHotkey\UX\inc\identify.ahk
    003: {
    005: p := 1, count_1 := count_2 := 0, version := marks := ''
▶   006: While (p := RegExMatch(code, identify_regex, &m, p))
    006: {
    007: p += m.Len()

Call stack:
C:\Program Files\AutoHotkey\UX\inc\identify.ahk (6) : [RegExMatch] While (p := RegExMatch(code, identify_regex, &m, p))
C:\Program Files\AutoHotkey\UX\inc\identify.ahk (6) : [IdentifyBySyntax] While (p := RegExMatch(code, identify_regex, &m, p))
C:\Program Files\AutoHotkey\UX\launcher.ahk (72) : [GetLaunchParameters] i := IdentifyBySyntax(code)
C:\Program Files\AutoHotkey\UX\launcher.ahk (139) : [IdentifyAndLaunch] lp := GetLaunchParameters(ScriptPath, !(whichMode := args.HasProp('which')))
C:\Program Files\AutoHotkey\UX\launcher.ahk (59) : [Main] IdentifyAndLaunch(ScriptPath, A_Args, switches)
C:\Program Files\AutoHotkey\UX\launcher.ahk (16) : [] Main()
> Auto-execute
Note that at no point my personal script file is mentioned. If of any help, I have this line near the top of it: SetTitleMatchMode "regex", but I doubt it has anything to do with the current problem.

Good thing is I still had the 2.0.9 installer. Reverted, and it is now running as normal, albeit in an outdated version.
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: AutoHotKey v2.0.11 has a PCRE execution error

15 Feb 2024, 21:58

In general, issues with syntax detection are triggered only by specific patterns in the script. It is virtually impossible to identify what the issue is or reproduce it without any clues as to what your script contains.

There were already at least two bug report threads regarding a PCRE execution error in the launcher, which may or may not be related, depending on what is triggering the error in your case.
viewtopic.php?f=14&t=124397
viewtopic.php?f=14&t=125088

Commit 3c20468 fixes one such error, and commit 9669002 facilitates troubleshooting by reporting the error in a more friendly way. These are both post-v2.0.11 (and hadn't been uploaded until now), but it is possible to update the relevant files manually.
I tried removing manually the v1 folder from Program Files\AutoHotKey
If you wish to remove a specific version of AutoHotkey, you should do so by running the AutoHotkey uninstaller and selecting only the relevant version.

Doing so will not prevent the launcher from attempting to identify the version required by a script, and therefore will not prevent this error from occurring. One important feature of the launcher is that it can often identify when the user is trying to run a script with a version of AutoHotkey that is not installed. In such a case, it can usually install the appropriate version automatically (after confirmation by the user).

If you have too many issues with the version detection or otherwise prefer not to use it, you can:
  • disable it in the launcher settings, and/or
  • add #Requires to all of your scripts.
User avatar
Ross
Posts: 100
Joined: 13 Mar 2016, 00:27

Re: AutoHotKey v2.0.11 has a PCRE execution error

18 Feb 2024, 02:43

@lexikos
Thanks for your kind, detailed and swift answer, Lexikos.
Yes I see the issue might have something to do with one of the 3283 lines of my main script, which is too long to post here (I wouldn't burden anyone with that, plus the privacy matter).
I'll never try deleting AHK files from the Program Files folder ever again.
So, I visited the links, the first of which pointing to this Reddit thread, where the user suggested a workaround: adding the

Code: Select all

#Requires AutoHotkey >=2.0
directive at the beginning.
I did, uninstalled 2.0.9 and installed 2.0.11. Now it's working! :D
lexikos
Posts: 9592
Joined: 30 Sep 2013, 04:07
Contact:

Re: AutoHotKey v2.0.11 has a PCRE execution error  Topic is solved

22 Mar 2024, 20:02

v2.0.12 fixes this, and/or at least handles PCRE execution errors better.

Return to “Bug Reports”

Who is online

Users browsing this forum: No registered users and 102 guests