1# zlib Error Codes 2 3> **NOTE** 4> 5> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](../errorcode-universal.md). 6 7## 900001 Invalid Source File 8 9**Error Message** 10 11The input source file is invalid. 12 13**Description** 14 15This error code is reported when the source file passed in the **compressFile()** or **decompressFile()** API is invalid. 16 17**Possible Causes** 18 19When 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. 20 21**Solution** 22 231. Make sure the source file exists. 242. Ensure that the source file is in ZIP format. 253. Make sure the path of the source file exists and the path is the correct sandbox path. 26 27## 900002 Invalid Destination File 28 29**Error Message** 30 31The input destination file is invalid. 32 33**Description** 34 35This error code is reported when the destination file passed in the **compressFile()** or **decompressFile()** API is invalid. 36 37**Possible Causes** 38 391. When the **compressFile()** API is called, the passed destination file path is invalid, for example, a non-exist sandbox path. 402. When the **decompressFile()** API is called, the destination folder does not exist. 41 42**Solution** 43 441. Check whether the destination file path is correct. If not, enter the correct sandbox path. 452. Check whether the destination folder exists. If not, create the folder. 46 47## 900003 Source File in Incorrect Format or Damaged 48 49**Error Message** 50 51The input source file is not in ZIP format or is damaged. 52 53**Description** 54 55This 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. 56 57 58**Possible Causes** 59 601. When the **decompressFile** API is called, the format of the source file is incorrect. 612. When the **decompressFile** API is called, the source file is incomplete or damaged. 62 63**Solution** 64 651. Check whether the source file is in ZIP format. 662. 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. 67 68## 17800002 Incorrect File or Access Mode 69 70**Error Message** 71 72No such file or access mode error. 73 74**Description** 75 76This 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. 77 78**Possible Causes** 79 801. When the **gzopen** API is called, the input file path or file access mode is incorrect. 812. When the **gzdopen** API is called, the input file descriptor or file access mode is incorrect. 82 83**Solution** 84 851. 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**). 862. Check whether the file access mode is **w**, **wb**, **r**, **rb**, **a**, and **ab**. 87 88## 17800004 Compressed or Decompressed Flow Error 89 90**Error Message** 91 92ZStream error. 93 94**Description** 95 96This error code is reported when an error occurs in compression or decompression stream when the **deflate** or **inflate** API is called. 97 98**Possible Causes** 99 1001. When the **deflate** or **inflate** API is called, the **deflateInit** or **inflateInit** API is not used to initialize the compression or decompression stream. 1012. 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. 102 103**Solution** 104 1051. Before calling the **deflate** or **inflate** API, use the **deflateInit** or **inflateInit** API to initialize the compression or decompression stream. 1062. Check whether the API for opening the **.gz** file is not called or fails to be called. 1073. 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**). 1084. Check whether the input enum parameter is correct. 109 110## 17800005 Incorrect Input Data 111 112**Error Message** 113 114Data error. 115 116**Description** 117 118This error code is reported when the input data is incorrect when the **uncompress** or **uncompress2** API is called. 119 120**Possible Causes** 121 122When the **uncompress** or **uncompress2** API is called, the **compress** API is not used for compression. 123 124**Solution** 125 126Use the **compress** API to compress the file before using the **uncompress2** or **uncompress** API to decompress the file. 127 128## 17800006 Memory Allocation Failure 129 130**Error Message** 131 132Memory allocation failed. 133 134**Description** 135 136This error code is reported when the memory allocation fails when the **gzclose** or **gzclosew** API is called. 137 138**Possible Causes** 139 140The **gzsetparams** API is called before calling the **gzclose** or **gzclosew** API. As a result, an incorrect compression level or compression strategy is passed in. 141 142**Solution** 143 144Check the whether the **gzsetparams** API is called and pass in the correct compression level and compression strategy. 145 146## 17800007 Incorrect Input Buffer 147 148**Error Message** 149 150Buffer error. 151 152**Description** 153 154This error code is reported when the input buffer is incorrect when the **compress**, **compress2**, **uncompress**, or **uncompress2** API is called. 155 156**Possible Causes** 157 1581. When the **uncompress** or **uncompress2** API is called, the input buffer size is greater than the output buffer size after decompression. 1592. When the **compress** or **compress2** API is called, the input buffer size is greater than the output buffer size after compression. 1603. When the **compress**, **compress2**, **uncompress**, or **uncompress2** API is called, the input buffer size is 0. 161 162**Solution** 163 164Increase the size of the corresponding buffer. 165 166## 17800009 Internal Structure Error 167 168**Error Message** 169 170Internal structure error. 171 172**Description** 173 174This 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. 175 176**Possible Causes** 177 1781. The API for opening the **.gz** file is not called or fails to be called. 1792. When the API for opening the **.gz** file is called, the input file access mode is incorrect. 1803. When the **gzwrite** API is called, the length of the input uncompressed byte is 0. 1814. When the **gzfwrite** or **gzfread** API is called, the size or number of input data blocks is 0. 1825. When the **gzprintf** API is called, the input format descriptor and plain text are empty strings. 1836. When the **gzgets** API is called, the input **ArrayBuffer** is empty. 1847. When the **gzgetc** API is called, the **.gz** file is empty. 185 186**Solution** 187 1881. Check whether the API for opening the **.gz** file is not called or fails to be called. 1892. 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**). 1903. Check whether the input parameter is correct. 191