Error when creating 3D Texture or 2D Texture array

Godot Version

4.5 Stable

Question

So I want to send a 3D Texture to a compute shader for debugging purposes.
On the Godot side i create a Texture but always get this error:

Default supplied data for image format is of invalid length (256), should be (1).

Here is my initialization code for the texture:

	tformat.texture_type = RenderingDevice.TEXTURE_TYPE_2D_ARRAY
	tformat.width = resolution.x
	tformat.height = resolution.y
	tformat.depth = 1
	tformat.format = RenderingDevice.DATA_FORMAT_R8G8B8A8_UNORM
	tformat.usage_bits = RenderingDevice.TEXTURE_USAGE_SAMPLING_BIT | RenderingDevice.TEXTURE_USAGE_STORAGE_BIT | RenderingDevice.TEXTURE_USAGE_CAN_COPY_FROM_BIT
	tformat.mipmaps = 1

	# array of byte arrays.
	var data_for_all_slices = []
	# SINGLE 2D slice.
	var slice_size_in_bytes = resolution.x * resolution.y * 4 # 4 bytes for RGBA8

	# Loop for each slice (based on depth).`Preformatted text`
	for i in range(resolution.z):
		# Byte array  for the current slice.
		var single_slice_data = PackedByteArray()
		single_slice_data.resize(slice_size_in_bytes)
		
		for p in range(resolution.x * resolution.y):
			single_slice_data[p * 4 + 3] = 255
		
		data_for_all_slices.append(single_slice_data)
	
	var tview = RDTextureView.new()
	debug_RID = rd.texture_create(tformat, tview, data_for_all_slices)
	
	var debug_texture_uniform = RDUniform.new()
	debug_texture_uniform.uniform_type = rd.UNIFORM_TYPE_IMAGE
	debug_texture_uniform.binding = 4
	debug_texture_uniform.add_id(debug_RID)

It is the same problem when i use:

tformat.texture_type = RenderingDevice.TEXTURE_TYPE_3D