diff --git a/lib/gitlab/ci/config/external/mapper.rb b/lib/gitlab/ci/config/external/mapper.rb
index cff7954235fee9a3b3fa20fe3459e92cc7181b5e..fcd65b2f2d7e33bd4d7d8429a7a8b1d826080be9 100644
--- a/lib/gitlab/ci/config/external/mapper.rb
+++ b/lib/gitlab/ci/config/external/mapper.rb
@@ -11,6 +11,7 @@ class Mapper
           AmbigiousSpecificationError = Class.new(Error)
           TooManyIncludesError = Class.new(Error)
           TooMuchDataInPipelineTreeError = Class.new(Error)
+          InvalidTypeError = Class.new(Error)
 
           def initialize(values, context)
             @locations = Array.wrap(values.fetch(:include, [])).compact
diff --git a/lib/gitlab/ci/config/external/mapper/normalizer.rb b/lib/gitlab/ci/config/external/mapper/normalizer.rb
index 8fc798e78a0cc2a27e23c5ad08020dd940fae8c1..b07726f7c11accefdc5fd92fa964b519f74277d0 100644
--- a/lib/gitlab/ci/config/external/mapper/normalizer.rb
+++ b/lib/gitlab/ci/config/external/mapper/normalizer.rb
@@ -25,8 +25,10 @@ def process_without_instrumentation(locations)
                   location = variables_expander.expand(location)
 
                   normalize_location_string(location)
-                else
+                elsif location.is_a?(Hash)
                   location.deep_symbolize_keys
+                else
+                  raise Mapper::InvalidTypeError, 'Each include must be a hash or a string'
                 end
               end
             end
diff --git a/spec/lib/gitlab/ci/config/external/mapper/normalizer_spec.rb b/spec/lib/gitlab/ci/config/external/mapper/normalizer_spec.rb
index 09212833d84f22b27b74c51f2d6f4f9dcac239e6..6c80df084d1746025064337d3e059b654ad84261 100644
--- a/spec/lib/gitlab/ci/config/external/mapper/normalizer_spec.rb
+++ b/spec/lib/gitlab/ci/config/external/mapper/normalizer_spec.rb
@@ -40,5 +40,14 @@
          { remote: 'https://example.com/.gitlab-ci.yml' }]
       )
     end
+
+    context 'when the location value is an invalid type' do
+      let(:locations) { [123] }
+
+      it 'raises an error' do
+        expect { process }.to raise_error(
+          Gitlab::Ci::Config::External::Mapper::InvalidTypeError, /Each include must be a hash or a string/)
+      end
+    end
   end
 end
diff --git a/spec/lib/gitlab/ci/config/external/mapper_spec.rb b/spec/lib/gitlab/ci/config/external/mapper_spec.rb
index d67b0ff88959d7cf6d34d95cb64ea3642266f4e1..d6aa39c48494d6fd8365e970c6a5445c9484052f 100644
--- a/spec/lib/gitlab/ci/config/external/mapper_spec.rb
+++ b/spec/lib/gitlab/ci/config/external/mapper_spec.rb
@@ -174,6 +174,15 @@
 
         it_behaves_like 'logging config file fetch', 'config_file_fetch_project_content_duration_s', 1
       end
+
+      context 'when the include value is a Boolean' do
+        let(:values) { { include: true } }
+
+        it 'raises an error' do
+          expect { process }.to raise_error(
+            Gitlab::Ci::Config::External::Mapper::InvalidTypeError, /Each include must be a hash or a string/)
+        end
+      end
     end
 
     context "when 'include' is defined as an array" do
@@ -186,6 +195,15 @@
         expect(subject).to all(respond_to(:valid?))
         expect(subject).to all(respond_to(:content))
       end
+
+      context 'when an include value is an Array' do
+        let(:values) { { include: [remote_url, [local_file]] } }
+
+        it 'raises an error' do
+          expect { process }.to raise_error(
+            Gitlab::Ci::Config::External::Mapper::InvalidTypeError, /Each include must be a hash or a string/)
+        end
+      end
     end
 
     context "when 'include' is defined as an array of hashes" do