Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

In this Discussion

osTicket v1.10 (stable) and Maintenance Release v1.9.15 are now available! Go get it now

How to prevent duplicate tickets and threads

Since around March of this year our osTicket system started posting duplicate tickets and duplicate threads.

I've tried everything method I know of to troubleshoot and identity where and why this is occurring.  I've even implemented a catch condition to check the db tables prior to inserting tickets and threads to see if the contents of the $vars[]'s match what is already in the DB tables.

No success to solve this problem whatsoever.

I've Googled it and see where this issue has been in existence and dates back a number of years.

Does any one have a solution on how to stop osTicket from consistently creating ducpliate tickets and threads?


  • Please help us to help you by reading and following the posting guidelines located in this thread: Please read before requesting assistance.  The more information you give us the better we will be able to assist you. Thank you.

    Version of osTicket?
    HAve you added the ticket# to the subject of the email templates?
    Are the people replying the ticket owner or an agent?
    Are you collecting tickets via IMAP or POP?
    What are you doing with the emails afterwards?
  • Version of osTicket?
    one system is running 1.6
    one system is running 1.7

    Have you added the ticket# to the subject of the email templates?
    Ticket #90614 (I think this is what you are looking for here)

    Are the people replying the ticket owner or an agent?
    ticket owner

    Are you collecting tickets via IMAP or POP?
    direct, through web interface

    What are you doing with the emails afterwards?
    deleteing them
  • Neither of those versions are supported anymore.  I would recommend that you update.
  • but it should not matter as the same issue is happening in all versions up to the latest according to Google search results
  • Has anyone come up with a clever solution to this?

    I tried the following from piecing together suggestions others have made out there in the various osTicket up through v1.10. Here is the code I tried. It actually worked for 2-days straight, then began to fail again yesterday.

    Inserted around line 2498 in ./include/class.ticket.php right before `if($errors)  return 0;`.

      * J.Doe added to intercept duplicate ticket entries.
      * Updated:   2017-06-12
      * @author    John Doe <>

        SELECT ticketID FROM ost_ticket
              source      = "' . $vars['source'] . '"
          AND topic_id    = "' . $vars['topicId'] . '"
          AND url         = "' . $vars['url'] . '"
          AND priority_id = "' . $vars['priorityId'] . '"
          AND duedate     = "' . date( 'Y-m-d H:i:s', strtotime( $vars['duedate'] . ' ' . $vars['time'] ) ) . '"
          AND team_id     = "' . $vars['assignId'] . '"
          AND subject     = "' . $vars['subject'] . '"
          AND dept_id     = "' . $vars['deptId'] . '"
          AND email       = "' . $vars['email'] . '"
          AND name        = "' . $vars['name'] . '"

        SELECT id FROM ost_ticket_thread
              staff_id = "' . $vars['assignId'] . '"
          AND poster   = "' . $vars['name'] . '"
          AND title    = "' . $vars['subject'] . '"
          AND body     = "' . $vars['message'] . '"


      if( ( $res1 && db_num_rows( $res1 ) ) || ( $res2 && db_num_rows( $res2 ) ) ) {
          header( 'Location:' );

            //Any error above is fatal.
            if($errors)  return 0;

  • Has anyone ever tackled this issue?
  • Considering barely anyone uses versions that old, I do not think that you will get much traction on this thread.

    We do not have the problem with more contemporary versions.  The way emails become tickets and updates are made has changed dramaticly from back then.
  • If you Google this issue, there are dozens of posts relating to this specific problem.

    All I am interested in knowing is where and how someone honed in on where to fix it. Just even a hint.

    I cannot upgrade because we have customized the product since install in 2013 and there is no overlay or plugin facility available to extend this product. So core code updating needed to be done..

    Once installed we did not touch at all.

    Now in March of this year practically every ticket post is duplicated. When I researched it I found many, many people reporting the same issue. Clearly something happened in osTicket.

    I don't know what it is or why. But If I can just figure out where to cut it off that will make the product work effectively.

    So far I tracking through every "INSERT INTO..." and changing to INSERT IGNORE INTO..." praying that will solve the issue.

    Thanks for chiming in @ntozier.
  • When i google about duplicate tickets and osticket, i can't find alot, but the ones i find are not relating to 1.10, also the topics that do discuss the problem suggest problems with xampp, proxy, refreshing page and email clients that don't honor RFC.
Sign In or Register to comment.