diff --git a/script/openqa-load-templates b/script/openqa-load-templates
index d96db7f2c10..6d94c547158 100755
--- a/script/openqa-load-templates
+++ b/script/openqa-load-templates
@@ -120,16 +120,34 @@ sub post_entry ($table, $entry) {
     if ($table eq 'JobGroups') {
         # Create the group first
         my $job_groups_url = $url->clone->path($options{apibase} . '/job_groups');
-        my $res = $client->post($job_groups_url, form => {name => $entry->{group_name}})->res;
-        print_error $res unless $res->is_success;
-
+        my $existing_group_res = $client->get($job_groups_url, form => {name => $entry->{group_name}})->res;
+        my $group_exists = 0;
+        if ($existing_group_res->is_success) {
+            my $json = $existing_group_res->json;
+            for my $group (@$json) {
+                if ($group->{name} eq $entry->{group_name}) {
+                    $group_exists = 1
+                      if $options{update}
+                      or die
+                      "Job group '$entry->{group_name}' already exists. Use --update to modify existing entries.";
+                }
+            }
+        }
+        unless ($group_exists) {
+            my $create_res
+              = $client->post($job_groups_url, form => {name => $entry->{group_name}})->res;
+            print_error($create_res) unless $create_res->is_success;
+        }
         # Post the job template YAML
         my $job_templates_url = $url->clone->path($options{apibase} . '/job_templates_scheduling');
-        $res
-          = $client->post($job_templates_url,
-            form => {name => $entry->{group_name}, template => $entry->{template}, schema => 'JobTemplates-01.yaml'})
-          ->res;
-        print_error $res unless $res->is_success;
+        my $yaml_res = $client->post(
+            $job_templates_url,
+            form => {
+                name => $entry->{group_name},
+                template => $entry->{template},
+                schema => 'JobTemplates-01.yaml'
+            })->res;
+        print_error($yaml_res) unless $yaml_res->is_success;
         return 1;
     }
 
@@ -193,7 +211,6 @@ sub post_entry ($table, $entry) {
             }
         }
     }
-
     my $res = $client->post($table_url, json => \%param)->res;
     print_error $res unless $res->is_success;
     return 1;
@@ -214,7 +231,6 @@ if ($options{'clean'}) {
                 last unless $res->is_success;
             }
         }
-
         print_error $res unless $res->is_success;
     }
 }
diff --git a/t/40-script_load_dump_templates.t b/t/40-script_load_dump_templates.t
index 86d370df0e3..2b6892ee354 100644
--- a/t/40-script_load_dump_templates.t
+++ b/t/40-script_load_dump_templates.t
@@ -18,7 +18,6 @@ use OpenQA::Test::Utils qw(run_cmd test_cmd stop_service);
 use Mojo::JSON;    # booleans
 use Cpanel::JSON::XS ();
 
-
 sub test_once {
     # Report failure at the callsite instead of the test function
     local $Test::Builder::Level = $Test::Builder::Level + 1;
@@ -60,7 +59,9 @@ my $base_args = "--host $host --apikey $apikey --apisecret $apisecret";
 $args = "$base_args $filename";
 my $expected = qr/JobGroups.+=> \{ added => 1, of => 1 \}/;
 test_once $args, $expected, 'Admin may load templates', 0, 'successfully loaded templates';
-test_once $args, qr/group with existing name/, 'Duplicate job group', 255, 'failed on duplicate job group';
+test_once $args, qr/Use --update to modify/, 'Duplicate job group', 255, 'failed on duplicate job group';
+$args = "$base_args --update $filename";
+test_once $args, $expected, 'Update with existing job group', 0, 'updated template with existing job group';
 
 subtest 'test changing existing entries' => sub {
     # delete job group so that we can load the template again without running into duplicate job group error