1# zlib Error Codes 2<!--Kit: Ability Kit--> 3<!--Subsystem: BundleManager--> 4<!--Owner: @wanghang904--> 5<!--Designer: @hanfeng6--> 6<!--Tester: @kongjing2--> 7<!--Adviser: @Brilliantry_Rui--> 8 9> **NOTE** 10> 11> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](../errorcode-universal.md). 12 13## 900001 Invalid Source File 14 15**Error Message** 16 17The input source file is invalid. 18 19**Description** 20 21This error code is reported when the source file passed in the **compressFile()** or **decompressFile()** API is invalid. 22 23**Possible Causes** 24 25When the **compressFile()** API is called, the file to compress does not exist. When the **decompressFile()** API is called, the file to decompress does not exist. 26 27**Solution** 28 291. Make sure the source file exists. 302. Ensure that the source file is in ZIP format. 313. Make sure the path of the source file exists and the path is the correct sandbox path. 32 33## 900002 Invalid Destination File 34 35**Error Message** 36 37The input destination file is invalid. 38 39**Description** 40 41This error code is reported when the destination file passed in the **compressFile()** or **decompressFile()** API is invalid. 42 43**Possible Causes** 44 451. When the **compressFile()** API is called, the passed destination file path is invalid, for example, a non-exist sandbox path. 462. When the **decompressFile()** API is called, the destination folder does not exist. 47 48**Solution** 49 501. Check whether the destination file path is correct. If not, enter the correct sandbox path. 512. Check whether the destination folder exists. If not, create the folder. 52 53## 900003 Source File in Incorrect Format or Damaged 54 55**Error Message** 56 57The input source file is not in ZIP format or is damaged. 58 59**Description** 60 61This error code is reported when the format of the source file is incorrect or the source file is damaged when the **decompressFile** API is called. 62 63 64**Possible Causes** 65 661. When the **decompressFile** API is called, the format of the source file is incorrect. 672. When the **decompressFile** API is called, the source file is incomplete or damaged. 68 69**Solution** 70 711. Check whether the source file is in ZIP format. 722. Check whether the source file is complete. If the file is downloaded from the network, ensure that the file download is complete before calling the **decompressFile** API. 73 74## 17800002 Incorrect File or Access Mode 75 76**Error Message** 77 78No such file or access mode error. 79 80**Description** 81 82This error code is reported when the input file path, file descriptor, or file access mode is incorrect when the **gzopen** or **gzdopen** API is called. 83 84**Possible Causes** 85 861. When the **gzopen** API is called, the input file path or file access mode is incorrect. 872. When the **gzdopen** API is called, the input file descriptor or file access mode is incorrect. 88 89**Solution** 90 911. Check whether the .gz file path or file descriptor is correct. If a .gz file is created, ensure that the file access is in compression mode (such as **w** or **wb**). 922. Check whether the file access mode is **w**, **wb**, **r**, **rb**, **a**, and **ab**. 93 94## 17800004 Compressed or Decompressed Flow Error 95 96**Error Message** 97 98Compression or decompression stream error, which may be caused by an initialization error in the zlib stream structure or a modified structure. 99 100**Description** 101 102This error code is reported when an error occurs in compression or decompression stream when the **deflate** or **inflate** API is called. 103 104**Possible Causes** 105 1061. When the **deflate** or **inflate** API is called, the **deflateInit** or **inflateInit** API is not used to initialize the compression or decompression stream. 1072. When the **gzsetparams**, **gzclose**, or **gzflush** API is called, the input refresh mode is incorrect. When the API for opening a .gz file is called, the input file access mode is incorrect. 108 109**Solution** 110 1111. Before calling the **deflate** or **inflate** API, use the **deflateInit** or **inflateInit** API to initialize the compression or decompression stream. 1122. Check whether the API for opening the .gz file is not called or fails to be called. 1133. Check whether the input access mode matches the API when the API for opening the .gz file is called. For example, **gzprintf** is a compression API. When the API for opening a .gz file is called, the input access mode must be the compression mode (such as **w** or **wb**). 1144. Check whether the input enum parameter is correct. 115 116## 17800005 Incorrect Input Data 117 118**Error Message** 119 120The input data is incorrect. For example, the data does not conform to the zlib compression format, the compressed data is corrupted, or the data is not compressed. 121 122**Description** 123 124This error code is reported when the input data is incorrect when the **uncompress** or **uncompress2** API is called. 125 126**Possible Causes** 127 128When the **uncompress** or **uncompress2** API is called, the **compress** API is not used for compression. 129 130**Solution** 131 132Use the **compress** API to compress the file before using the **uncompress2** or **uncompress** API to decompress the file. 133 134## 17800006 Memory Allocation Failure 135 136**Error Message** 137 138Memory allocation failed. 139 140**Description** 141 142This error code is reported when the memory allocation fails when the **gzclose** or **gzclosew** API is called. 143 144**Possible Causes** 145 146The **gzsetparams** API is called before calling the **gzclose** or **gzclosew** API. As a result, an incorrect compression level or compression strategy is passed in. 147 148**Solution** 149 150Check the whether the **gzsetparams** API is called and pass in the correct compression level and compression strategy. 151 152## 17800007 Incorrect Input Buffer 153 154**Error Message** 155 156The input buffer is incorrect, and the output buffer is too small to accommodate the compressed or decompressed data. 157 158**Description** 159 160This error code is reported when the input buffer is incorrect when the **compress**, **compress2**, **uncompress**, or **uncompress2** API is called. 161 162**Possible Causes** 163 1641. When the **uncompress** or **uncompress2** API is called, the input buffer size is greater than the output buffer size after decompression. 1652. When the **compress** or **compress2** API is called, the input buffer size is greater than the output buffer size after compression. 1663. When the **compress**, **compress2**, **uncompress**, or **uncompress2** API is called, the input buffer size is 0. 167 168**Solution** 169 170Increase the size of the corresponding buffer. 171 172## 17800009 Internal Structure Error 173 174**Error Message** 175 176Internal structure error. 177 178**Description** 179 180This error code is reported when the input parameter is incorrect when the **gzputc**, **gzwrite**, or **gzread** API is called, or when the input file access mode is incorrect when the API for opening the .gz file is called. 181 182**Possible Causes** 183 1841. The API for opening the .gz file is not called or fails to be called. 1852. When the API for opening the .gz file is called, the input file access mode is incorrect. 1863. When the **gzwrite** API is called, the length of the input uncompressed byte is 0. 1874. When the **gzfwrite** or **gzfread** API is called, the size or number of input data blocks is 0. 1885. When the **gzprintf** API is called, the input format descriptor and plain text are empty strings. 1896. When the **gzgets** API is called, the input **ArrayBuffer** is empty. 1907. When the **gzgetc** API is called, the .gz file is empty. 191 192**Solution** 193 1941. Check whether the API for opening the .gz file is not called or fails to be called. 1952. Check whether the input access mode matches the API when the API for opening the .gz file is called. For example, **gzgetc** is a decompression API, so the input access mode should be decompression mode (such **r** or **rb**). 1963. Check whether the input parameter is correct. 197