Problem going from 2D texture to 2D texture array

Hi, I wanted to use 2D texture as texture atlas for road tiles rendered on heightmap. I prepared sample plain 2D transparent texture and rendered it over ground color. I have grid texture blended over this that works fine.

Now, I wanted to use 2D_TEXTURE_ARRAY instead of this middle texture. I use this example https://www.khronos.org/opengl/wiki/Array_Texture. I copied code from tutorial and my fragment shader gets black color. There is no error when calling glGetError(), but “Error 00000502 after fill simple” is printed to console.

I failed somewhere after texture change, that’s why I guess I set something wrong. What could be a problem?

Texture setup:

GLubyte texels[32] = 
{
     //Texels for first image.
     0,   0,   0,   255,
     255, 0,   0,   255,
     0,   255, 0,   255,
     0,   0,   255, 255,
     //Texels for second image.
     255, 255, 255, 255,
     255, 255,   0, 255,
     0,   255, 255, 255,
     255, 0,   255, 255,
};

    // Texture of the ground
    GLenum err;
    glGenTextures(1, &roadTexture);
    glBindTexture(GL_TEXTURE_2D_ARRAY, roadTexture);
    glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_S, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_WRAP_T, GL_REPEAT);
    glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MIN_FILTER, GL_LINEAR_MIPMAP_LINEAR);
    glTexParameteri(GL_TEXTURE_2D_ARRAY, GL_TEXTURE_MAG_FILTER, GL_LINEAR);
    glTexStorage3D(GL_TEXTURE_2D_ARRAY, 1, GL_RGBA8, 2, 2, 2);
    glTexSubImage3D(GL_TEXTURE_2D_ARRAY, 0, 0, 0, 0, 2, 2, 2, GL_RGBA, GL_UNSIGNED_BYTE, texels);

Fragment shader:

#version 430 core

layout (binding = 0) uniform sampler2D groundTexture;
layout (binding = 1) uniform sampler2DArray roadTexture;

//...

in vec3 vPos;
out vec4 color;

void main() {
  // ...
  color = vec4(0.624f, 0.643f, 0.318f, 1);

  vec4 roadColor = texture2DArray(roadTexture, vec3(vPos.xz, 0));
  color = vec4(mix(color.xyz, roadColor.xyz, roadColor.w), 1); // color = vec4(roadColor.xyz, 1); also gives black
  // ...
}