Error -609 connection invalid

  1. 2 weeks ago

    Beatrix W

    Oct 12 Pre-Release Testers Europe (Germany)
    Edited 2 weeks ago by Beatrix W

    I'm using AppleScripts with NSAppleScriptMBS to get data out of Mail. Now and then I get error reports from customers with the error -609 connection invalid. Does anyone have an idea what might cause this?

    Here are some session logs:

    2017-09-04, 15:31:11 emlxIterator.GetNumberOfObjects 268
    2017-09-04, 16:08:10 ApplescriptError: -609:„Mail“ hat einen Fehler erhalten: Die Verbindung ist ungültig. (Translation: Mail got an error, connection invalid)
    2017-09-04, 16:08:10 Error in Range: {316, 6}
    2017-09-04, 16:08:10 Scripttext: property Mailbox0: ""
    property Mailbox1: ""
    property currentMessageStr: "0"
    with timeout of 10000 seconds
    set currentMessage to currentMessageStr as integer
    tell application "Mail"
    set theMessage to (message currentMessage of mailbox (Mailbox1) of account (Mailbox0))
    if not deleted status of theMessage then
    return source of theMessage
    end if
    end tell
    end timeout
    2017-09-04, 16:08:11 Script Properties: Mailbox0: Bapfoto
    Mailbox1: INBOX
    currentMessageStr: 8

    2017-09-19, 15:31:41 ApplescriptError: -609:„Mail“ hat einen Fehler erhalten: Die Verbindung ist ungültig.
    2017-09-19, 15:31:41 Error in Range: {316, 6}
    2017-09-19, 15:31:41 Scripttext: property Mailbox0: ""
    property Mailbox1: ""
    property currentMessageStr: "0"
    with timeout of 10000 seconds
    set currentMessage to currentMessageStr as integer
    tell application "Mail"
    set theMessage to (message currentMessage of mailbox (Mailbox1) of account (Mailbox0))
    if not deleted status of theMessage then
    return source of theMessage
    end if
    end tell
    end timeout
    2017-09-19, 15:31:41 Script Properties: Mailbox0: Bapfoto
    Mailbox1: INBOX
    currentMessageStr: 8
    2017-09-19, 15:31:41 Dialog: Beim Archivieren der Mails trat ein Fehler auf! Du mußt Mail neu starten.

    2017-10-11, 15:30:24 emlxIterator.Constructor MailboxPath: Bapfoto:::INBOX
    2017-10-11, 15:30:24 emlxIterator.GetNumberOfObjects 342
    2017-10-11, 18:17:05 App.HandleUpdateAction
    2017-10-11, 20:02:56 ApplescriptError: -609:„Mail“ hat einen Fehler erhalten: Die Verbindung ist ungültig.
    2017-10-11, 20:02:56 Error in Range: {200, 22}
    2017-10-11, 20:02:56 Scripttext: property Mailbox0: ""
    property Mailbox1: ""
    property currentMessageStr: "0"
    with timeout of 10000 seconds
    set currentMessage to currentMessageStr as integer
    tell application "Mail"
    set theMessage to (message currentMessage of mailbox (Mailbox1) of account (Mailbox0))
    if not deleted status of theMessage then
    return source of theMessage
    end if
    end tell
    end timeout
    2017-10-11, 20:02:56 Script Properties: Mailbox0: Bapfoto
    Mailbox1: INBOX
    currentMessageStr: 6
    2017-10-11, 20:02:57 App.HandleUpdateAction done
    2017-10-11, 20:02:57 Dialog: Beim Archivieren der Mails

    And then getting the data works fine:

    2017-10-11, 20:04:16 emlxIterator.Constructor MailboxPath: Bapfoto:::INBOX
    2017-10-11, 20:04:16 emlxIterator.GetNumberOfObjects 404
    2017-10-11, 20:06:17 emlxIterator.Constructor MailboxPath: Bapfoto:::Sent Messages

    I know it's not the script itself which is created dynamically. The problem occurs with the first mails. Why does the script sometimes work and sometimes it doesn't? Unfortunately, I've never seen this problem myself.

    Xojo 2017r1, latest MBS. macOS 10.13 for the customer.

    Mit freundlichen Grüßen/Regards

    Beatrix Willius

    http://www.mothsoftware.com
    Mail Archiver X: The email archiving solution for professionals

  2. Eli O

    is not verified Oct 12 Europe (Berlin, Germany)

    @Beatrix W I know it's not the script itself which is created dynamically. The problem occurs with the first mails. Why does the script sometimes work and sometimes it doesn't?

    When you google for this error some answers are about that the application which is being queried by AppleScript is not answering and putting a delay in the script reduces the chances that this happens. This could explain why it happens only on the first emails. Just a wild guess though...

  3. Beatrix W

    Oct 12 Pre-Release Testers Europe (Germany)

    Wild ideas are great. The script with variations can be executed thousands of times. It's already not very fast. Delays are not possible.

    AppleScripts are executed when the app isn't busy. But I never know if Mail is busy or not.

    I'll have the user check if always the same mail is affected.

or Sign Up to reply!