Crash (SIGABRT) using Prompter twice in the same script

Tap Forms Database Pro for Mac, iPhone, iPad and Apple Watch Forums Using Tap Forms Pro Crash (SIGABRT) using Prompter twice in the same script

Viewing 2 reply threads
  • Author
    Posts
  • September 17, 2026 at 10:36 AM #54530

    Melanie Schaaf
    Participant

    Hi Brandon,
    hi all,

    I have been experimenting with a script in the last couple of days and ended up with a reproducible crash of Tap Forms with one version of it, that I thought that someone might want to look into. (Disclaimer: AI helped me write the script as my capabilities in JavaScript are beginner level at best).

    What I was doing: I have a script button on a custom layout that lets me pick an existing record from another form and link it via record.addRecordToField(), using Prompter.new() with a ‘popup’ parameter to show the choices. To add several linked records in one go, we wrapped that in a while loop and added a second Prompter (a simple Yes/No confirm using addParameter(message, null, “label”)) asking “add another?” after each pick.

    The bug: As soon as this script has two different Prompter-based functions in it — even though the second one (the confirm) is never actually reached — the very first prompt crashes the whole app the moment I click its Continue button. It’s 100% reproducible, happens both from the live layout button and from the script editor’s own Run button, and happens regardless of which item I pick in the dropdown (including leaving it on the default first item).

    If I strip the script down to a single Prompter call with no loop and no second Prompter function anywhere in the script, it works perfectly every time.

    Here’s the full script that causes the crash:

    async function Pick_Subtheme() {
    await pickSubtheme();
    }

    async function pickSubtheme() {
    var keepAdding = true;
    while (keepAdding) {
    var chosen = await promptPopup(“Add a Subtheme:”, “Pick Subtheme”, [“Episode IV – A New Hope”, “Episode VI – Return of the Jedi”, “Classic Star Wars”, “Lego Star Wars – Ultimate Collector’s Series”]);
    if (!chosen) { keepAdding = false; break; }
    // … link the chosen record …
    keepAdding = await promptConfirm(“Add another Subtheme?”, “Add Subtheme”, “Done”);
    }
    }

    function promptPopup(message, popupName, valuesArray) {
    return new Promise(function (resolve) {
    choice = undefined;
    var p = Prompter.new();
    p.addParameter(message, “choice”, “popup”, valuesArray, valuesArray[0]);
    p.cancelButtonTitle = “Cancel”;
    p.continueButtonTitle = “Add”;
    p.show(popupName, function (status) {
    resolve(status === true ? choice : false);
    });
    });
    }

    function promptConfirm(message, continueTitle, cancelTitle) {
    return new Promise(function (resolve) {
    var p = Prompter.new();
    p.addParameter(message, null, “label”);
    p.cancelButtonTitle = cancelTitle;
    p.continueButtonTitle = continueTitle;
    p.show(message, function (status) {
    resolve(status === true);
    });
    });
    }

    var choice;
    Pick_Subtheme();

    The crash happens the moment I click “Add” on the very first popup — execution never even reaches promptConfirm.

    Crash log (Thread 0, the crashed thread):

    Exception Type: EXC_CRASH (SIGABRT)
    Exception Codes: 0x0000000000000000, 0x0000000000000000
    Exception Reason: *** -[__NSArrayM objectAtIndex:]: index 1 beyond bounds [0 .. 0]

    Termination Reason: Namespace SIGNAL, Code 6, Abort trap: 6
    Terminating Process: Tap Forms Pro [31720]

    Thread 0 Crashed:: Dispatch queue: com.apple.main-thread

    10 CoreFoundation -[__NSArrayM objectAtIndex:] + 592
    11 Tap Forms Pro 0x104f1a564 0x104dd0000 + 1353060
    12 CoreFoundation __CFNOTIFICATIONCENTER_IS_CALLING_OUT_TO_AN_OBSERVER__ + 148

    I am using Tap Forms Pro 1.3.1 (Build 560) with macOS Tahoe 26.6.2.

    I’m happy to send the full crash report if useful. Thanks for looking into it!

    Melanie

    September 17, 2026 at 3:39 PM #54531

    Daniel Leu
    Participant

    The issue is in promptConfirm, but I haven’t isolated it yet. I think it’s related to ‘null’ and ‘label’.

    I have a prompter library that implements this function as well. Due to a lack of time, I just used this with your code. You need to install my scriptHandler from https://lab.danielleu.com/tapformspro/script-library/scripthandler.html. This will install the prompterHelper as well which is used by the script.

    document.getFormNamed("scriptHandler").runScriptNamed("prompterHelper");
    
    async function Pick_Subtheme() {
        await pickSubtheme();
    }
    
    async function pickSubtheme() {
        var subthemes = [
            "Episode IV – A New Hope",
            "Episode VI – Return of the Jedi",
            "Classic Star Wars",
            "Lego Star Wars – Ultimate Collector's Series"
        ];
    
        var selected = [];
        var keepAdding = true;
        while (keepAdding) {
            try {
                await picklistPrompter("Pick Subtheme", "Add a Subtheme:", subthemes, subthemes[0]);
            } catch (err) {
                console.log("Cancelled: " + err, "#ff0000");
                break;
            }
    
            var chosen = prompterVar;
            selected.push(chosen);
            console.log("Selected: " + chosen);
            // … link the chosen record …
    
            var again = await yesnoPrompter("Add another Subtheme?", "Add Subtheme", "Done");
            keepAdding = (again === "Add Subtheme");
        }
    
        if (selected.length === 0) {
            console.log("No subthemes selected.");
        } else {
            console.log("Subthemes selected (" + selected.length + "): " + selected.join(", "));
        }
    }
    
    Pick_Subtheme();
    

    Cheers, Daniel

    ---
    See https://lab.danielleu.com/tapformspro/ for scripts and tips&tricks

    September 18, 2026 at 2:04 AM #54532

    Melanie Schaaf
    Participant

    Hi Daniel,

    Thanks so much for taking the time to look into this and reply; I really appreciate that!

    Your diagnosis lines up with what I found through my own trial and error: I’d isolated the crash to the same spot, a loop combined with a second, differently-shaped Prompter (the null/’label’ confirm dialog alongside the popup one). Good to have that independently confirmed, this makes me more confident it’s a real bug worth Brendan’s attention rather than something odd in my own setup.

    Your scriptHandler/prompterHelper tool looks interesting! Thank you for providing this! I may well come back to it if I want the smoother “pick several at once” experience down the line. For now though, I’ve got a single-shot-per-click version running that avoids the crash entirely, but I might get tired of the extra clicking every time I want to link an additional record. So I’ll definitely keep your library in mind.

    Thanks again for chiming in. Also hoping you or Brendan might actually be able to isolate that underlying bug in future, but this was a great start.

    Best,
    Melanie

    September 18, 2026 at 11:35 PM #54542

    Brendan
    Keymaster

    Hi Melanie,

    If you could please email me a sample form and script that demonstrates this crash that would really help me to figure it out. Send it to support@tapforms.com

    Thanks,

    Brendan

Viewing 2 reply threads

You must be logged in to reply to this topic.