The metadata that deals with the tile matrixes in the GeoPackage that you provided are not valid and I suppose I could locate where the problem is.
I used the GeoPackage validator script from the GDAL project from here https://github.com/OSGeo/gdal/blob/master/gdal/swig/python/samples/validate_gpkg.py
The script gives this error:
Req 45: Inconsistent values in gpkg_tile_matrix and
gpkg_tile_matrix_set for table M3_002345621_45613
The requirement 45 in the GeoPackage standard is this:
The width of a tile matrix (the difference between min_x and max_x in
gpkg_tile_matrix_set) SHALL equal the product of matrix_width,
tile_width, and pixel_x_size for that zoom level. Similarly, height of
a tile matrix (the difference between min_y and max_y in
gpkg_tile_matrix_set) SHALL equal the product of matrix_height,
tile_height, and pixel_y_size for that zoom level.
The gpkg_tile_matrix table MAY contain row records for zoom levels in
a tile pyramid user data table that do not contain tiles.
GeoPackages follow the most frequently used conventions of a tile
origin at the upper left and a zoom-out-level of 0 for the smallest
map scale "whole world" zoom level view [K20], as specified by WMTS
. The tile coordinate (0,0) always refers to the tile in the upper
left corner of the tile matrix at any zoom level, regardless of the
actual availability of that tile.
The (max_x - min_x) in gpkg_tile_matrix_set is about 402 meters.
In the gpkg_tile_matrix table for example zoom level 8 is defined to have 256 horizontal tiles with 256 pixels each and having pixel size of about 611 meters.
402 is not not equal to (256 x 256 x 611) which makes the metadata invalid.
It seems that this open ticket in the GeoServer bugs is about the same issue https://osgeo-org.atlassian.net/browse/GEOS-8262.
You may want to add your comment to the ticket.
Your GeoPackage is created to use the global Web Mercator projection and then there is an easy workaround. The following SQL command sets the bounds of the tile matrix set right and then QGIS can open the GeoPackage raster layer fine.
You can use any SQLite SQL client you want. Spatialite-gui is one alternative or you can use ogrinfo as a SQLite client from command line:
ogrinfo -sql "update gpkg_tile_matrix_set set min_x=-20037508.340000,min_y=-20037507.852000,max_x=20037507.852000,max_y=20037508.340000" test-mosaic_0.gpkg