java.io.IOException: Dimap Product Reader Error

I have a raster dataset with 81 band which I changed the band names and saved as beam dimap format. And now I wanted to convert my data from .dim to GeoTIFF-BigTiff format but It throws me an error like this:

java.io.FileNotFoundException: D:\S1S2stack_2020.data\collocationFlags_S2_2020_10.img (Sistem belirtilen dosyayı bulamıyor)
at java.io.RandomAccessFile.open0(Native Method)
at java.io.RandomAccessFile.open(RandomAccessFile.java:316)
at java.io.RandomAccessFile.(RandomAccessFile.java:243)
at javax.imageio.stream.FileImageInputStream.(FileImageInputStream.java:73)
at org.esa.snap.core.dataio.dimap.DimapProductReader.readBandRasterDataImpl(DimapProductReader.java:300)
Caused: java.io.IOException: DimapProductReader: Unable to read file ‘D:\S1S2stack_2020.data\collocationFlags_S2_2020_10.img’ referenced by ‘collocationFlags_S2_2020_10’.
at org.esa.snap.core.dataio.dimap.DimapProductReader.readBandRasterDataImpl(DimapProductReader.java:318)
at org.esa.snap.core.dataio.AbstractProductReader.readBandRasterData(AbstractProductReader.java:277)
at org.esa.snap.core.image.BandOpImage.computeProductData(BandOpImage.java:68)
at org.esa.snap.core.image.RasterDataNodeOpImage.computeRect(RasterDataNodeOpImage.java:127)
Caused: java.lang.RuntimeException
at org.esa.snap.core.image.RasterDataNodeOpImage.computeRect(RasterDataNodeOpImage.java:129)
at javax.media.jai.SourcelessOpImage.computeTile(Unknown Source)
Caused: org.esa.snap.core.gpf.OperatorException: java.io.IOException: DimapProductReader: Unable to read file ‘D:\S1S2stack_2020.data\collocationFlags_S2_2020_10.img’ referenced by ‘collocationFlags_S2_2020_10’.
at org.esa.snap.core.gpf.internal.OperatorExecutor$GPFImagingListener.errorOccurred(OperatorExecutor.java:381)
at com.sun.media.jai.util.SunTileScheduler.sendExceptionToListener(Unknown Source)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(Unknown Source)
at javax.media.jai.OpImage.getTile(Unknown Source)
at javax.media.jai.PlanarImage.getData(Unknown Source)
at com.bc.ceres.glevel.MultiLevelImage.getData(MultiLevelImage.java:64)
at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:449)
at org.esa.snap.core.gpf.internal.OperatorContext.getSourceTile(OperatorContext.java:435)
at org.esa.snap.core.gpf.internal.OperatorImage.computeRect(OperatorImage.java:75)
at javax.media.jai.SourcelessOpImage.computeTile(Unknown Source)
at com.sun.media.jai.util.SunTileScheduler.scheduleTile(Unknown Source)
at javax.media.jai.OpImage.getTile(Unknown Source)
at com.sun.media.jai.util.RequestJob.compute(Unknown Source)
[catch] at com.sun.media.jai.util.WorkerThread.run(Unknown Source)

Is it possible that you have moved the *.dim file but not the *.data folder?
Otherwise, it seems it wasn’t safely saved for some reason.

I double-checked the folder .dim and .data. They are located in the same folder. But when I tried to visualize my .dim file with Open Image Window, some bands gave me the same error. I’ll try to save the file again, as you said it looks like it corrupted somehow.

An “Unable to read file” error could mean there is a problem with the associated .hdr metadata file.

Each .img file in a the BEAM-DIMAP data directory should have a companion .hdr file. You may get a more helpful error message with gdalinfo (command-line), QGIS, or or a commercial GIS package. The .hdr file is plain text and many entries are self-explanatory. Here is an example from an SST data set I happened to have handy:

ENVI
description = {Sea Surface Temperature - Unit: degree_C}
samples = 8640
lines = 4320
bands = 1
header offset = 0
file type = ENVI Standard
data type = 12
interleave = bsq
byte order = 1
band names = { sst }
map info = {Geographic Lat/Lon,4321.5,2161.5,0.02082824707028408,-0.020833333333328596,0.041666666666666664,0.041666666666666664,WGS84,units=Degrees}
coordinate system string = {GEOGCS["WGS84(DD)", DATUM["WGS84", SPHEROID["WGS84", 6378137.0, 298.257223563]], PRIMEM["Greenwich", 0.0], UNIT["degree", 0.017453292519943295], AXIS["Geodetic longitude", EAST], AXIS["Geodetic latitude", NORTH]]}
data gain values = {7.171849720180035E-4}
data offset values = {-2.0}

It would be useful to check which bands can be opened in a third party program.

My Windows 10 Pro system thinks .img files are disk images. Some “enterprise” configurations don’t allow users to open potentially dangerous file types. In that case,
all bands will fail.