1e41f4b71Sopenharmony_ci# zlib Error Codes
2e41f4b71Sopenharmony_ci
3e41f4b71Sopenharmony_ci> **NOTE**
4e41f4b71Sopenharmony_ci>
5e41f4b71Sopenharmony_ci> This topic describes only module-specific error codes. For details about universal error codes, see [Universal Error Codes](../errorcode-universal.md).
6e41f4b71Sopenharmony_ci
7e41f4b71Sopenharmony_ci## 900001 Invalid Source File
8e41f4b71Sopenharmony_ci
9e41f4b71Sopenharmony_ci**Error Message**
10e41f4b71Sopenharmony_ci
11e41f4b71Sopenharmony_ciThe input source file is invalid.
12e41f4b71Sopenharmony_ci
13e41f4b71Sopenharmony_ci**Description**
14e41f4b71Sopenharmony_ci
15e41f4b71Sopenharmony_ciThis error code is reported when the source file passed in the **compressFile()** or **decompressFile()** API is invalid.
16e41f4b71Sopenharmony_ci
17e41f4b71Sopenharmony_ci**Possible Causes**
18e41f4b71Sopenharmony_ci
19e41f4b71Sopenharmony_ciWhen 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.
20e41f4b71Sopenharmony_ci
21e41f4b71Sopenharmony_ci**Solution**
22e41f4b71Sopenharmony_ci
23e41f4b71Sopenharmony_ci1. Make sure the source file exists.
24e41f4b71Sopenharmony_ci2. Ensure that the source file is in ZIP format.
25e41f4b71Sopenharmony_ci3. Make sure the path of the source file exists and the path is the correct sandbox path.
26e41f4b71Sopenharmony_ci
27e41f4b71Sopenharmony_ci## 900002 Invalid Destination File
28e41f4b71Sopenharmony_ci
29e41f4b71Sopenharmony_ci**Error Message**
30e41f4b71Sopenharmony_ci
31e41f4b71Sopenharmony_ciThe input destination file is invalid.
32e41f4b71Sopenharmony_ci
33e41f4b71Sopenharmony_ci**Description**
34e41f4b71Sopenharmony_ci
35e41f4b71Sopenharmony_ciThis error code is reported when the destination file passed in the **compressFile()** or **decompressFile()** API is invalid.
36e41f4b71Sopenharmony_ci
37e41f4b71Sopenharmony_ci**Possible Causes**
38e41f4b71Sopenharmony_ci
39e41f4b71Sopenharmony_ci1. When the **compressFile()** API is called, the passed destination file path is invalid, for example, a non-exist sandbox path.
40e41f4b71Sopenharmony_ci2. When the **decompressFile()** API is called, the destination folder does not exist.
41e41f4b71Sopenharmony_ci
42e41f4b71Sopenharmony_ci**Solution**
43e41f4b71Sopenharmony_ci
44e41f4b71Sopenharmony_ci1. Check whether the destination file path is correct. If not, enter the correct sandbox path.
45e41f4b71Sopenharmony_ci2. Check whether the destination folder exists. If not, create the folder.
46e41f4b71Sopenharmony_ci
47e41f4b71Sopenharmony_ci## 900003 Source File in Incorrect Format or Damaged
48e41f4b71Sopenharmony_ci
49e41f4b71Sopenharmony_ci**Error Message**
50e41f4b71Sopenharmony_ci
51e41f4b71Sopenharmony_ciThe input source file is not in ZIP format or is damaged.
52e41f4b71Sopenharmony_ci
53e41f4b71Sopenharmony_ci**Description**
54e41f4b71Sopenharmony_ci
55e41f4b71Sopenharmony_ciThis 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.
56e41f4b71Sopenharmony_ci
57e41f4b71Sopenharmony_ci
58e41f4b71Sopenharmony_ci**Possible Causes**
59e41f4b71Sopenharmony_ci
60e41f4b71Sopenharmony_ci1. When the **decompressFile** API is called, the format of the source file is incorrect.
61e41f4b71Sopenharmony_ci2. When the **decompressFile** API is called, the source file is incomplete or damaged.
62e41f4b71Sopenharmony_ci
63e41f4b71Sopenharmony_ci**Solution**
64e41f4b71Sopenharmony_ci
65e41f4b71Sopenharmony_ci1. Check whether the source file is in ZIP format.
66e41f4b71Sopenharmony_ci2. 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.
67e41f4b71Sopenharmony_ci
68e41f4b71Sopenharmony_ci## 17800002 Incorrect File or Access Mode
69e41f4b71Sopenharmony_ci
70e41f4b71Sopenharmony_ci**Error Message**
71e41f4b71Sopenharmony_ci
72e41f4b71Sopenharmony_ciNo such file or access mode error.
73e41f4b71Sopenharmony_ci
74e41f4b71Sopenharmony_ci**Description**
75e41f4b71Sopenharmony_ci
76e41f4b71Sopenharmony_ciThis 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.
77e41f4b71Sopenharmony_ci
78e41f4b71Sopenharmony_ci**Possible Causes**
79e41f4b71Sopenharmony_ci
80e41f4b71Sopenharmony_ci1. When the **gzopen** API is called, the input file path or file access mode is incorrect.
81e41f4b71Sopenharmony_ci2. When the **gzdopen** API is called, the input file descriptor or file access mode is incorrect.
82e41f4b71Sopenharmony_ci
83e41f4b71Sopenharmony_ci**Solution**
84e41f4b71Sopenharmony_ci
85e41f4b71Sopenharmony_ci1. 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**).
86e41f4b71Sopenharmony_ci2. Check whether the file access mode is **w**, **wb**, **r**, **rb**, **a**, and **ab**.
87e41f4b71Sopenharmony_ci
88e41f4b71Sopenharmony_ci## 17800004 Compressed or Decompressed Flow Error
89e41f4b71Sopenharmony_ci
90e41f4b71Sopenharmony_ci**Error Message**
91e41f4b71Sopenharmony_ci
92e41f4b71Sopenharmony_ciZStream error.
93e41f4b71Sopenharmony_ci
94e41f4b71Sopenharmony_ci**Description**
95e41f4b71Sopenharmony_ci
96e41f4b71Sopenharmony_ciThis error code is reported when an error occurs in compression or decompression stream when the **deflate** or **inflate** API is called.
97e41f4b71Sopenharmony_ci
98e41f4b71Sopenharmony_ci**Possible Causes**
99e41f4b71Sopenharmony_ci
100e41f4b71Sopenharmony_ci1. When the **deflate** or **inflate** API is called, the **deflateInit** or **inflateInit** API is not used to initialize the compression or decompression stream.
101e41f4b71Sopenharmony_ci2. 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.
102e41f4b71Sopenharmony_ci
103e41f4b71Sopenharmony_ci**Solution**
104e41f4b71Sopenharmony_ci
105e41f4b71Sopenharmony_ci1. Before calling the **deflate** or **inflate** API, use the **deflateInit** or **inflateInit** API to initialize the compression or decompression stream.
106e41f4b71Sopenharmony_ci2. Check whether the API for opening the **.gz** file is not called or fails to be called.
107e41f4b71Sopenharmony_ci3. 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**).
108e41f4b71Sopenharmony_ci4. Check whether the input enum parameter is correct.
109e41f4b71Sopenharmony_ci
110e41f4b71Sopenharmony_ci## 17800005 Incorrect Input Data
111e41f4b71Sopenharmony_ci
112e41f4b71Sopenharmony_ci**Error Message**
113e41f4b71Sopenharmony_ci
114e41f4b71Sopenharmony_ciData error.
115e41f4b71Sopenharmony_ci
116e41f4b71Sopenharmony_ci**Description**
117e41f4b71Sopenharmony_ci
118e41f4b71Sopenharmony_ciThis error code is reported when the input data is incorrect when the **uncompress** or **uncompress2** API is called.
119e41f4b71Sopenharmony_ci
120e41f4b71Sopenharmony_ci**Possible Causes**
121e41f4b71Sopenharmony_ci
122e41f4b71Sopenharmony_ciWhen the **uncompress** or **uncompress2** API is called, the **compress** API is not used for compression.
123e41f4b71Sopenharmony_ci
124e41f4b71Sopenharmony_ci**Solution**
125e41f4b71Sopenharmony_ci
126e41f4b71Sopenharmony_ciUse the **compress** API to compress the file before using the **uncompress2** or **uncompress** API to decompress the file.
127e41f4b71Sopenharmony_ci
128e41f4b71Sopenharmony_ci## 17800006 Memory Allocation Failure
129e41f4b71Sopenharmony_ci
130e41f4b71Sopenharmony_ci**Error Message**
131e41f4b71Sopenharmony_ci
132e41f4b71Sopenharmony_ciMemory allocation failed.
133e41f4b71Sopenharmony_ci
134e41f4b71Sopenharmony_ci**Description**
135e41f4b71Sopenharmony_ci
136e41f4b71Sopenharmony_ciThis error code is reported when the memory allocation fails when the **gzclose** or **gzclosew** API is called.
137e41f4b71Sopenharmony_ci
138e41f4b71Sopenharmony_ci**Possible Causes**
139e41f4b71Sopenharmony_ci
140e41f4b71Sopenharmony_ciThe **gzsetparams** API is called before calling the **gzclose** or **gzclosew** API. As a result, an incorrect compression level or compression strategy is passed in.
141e41f4b71Sopenharmony_ci
142e41f4b71Sopenharmony_ci**Solution**
143e41f4b71Sopenharmony_ci
144e41f4b71Sopenharmony_ciCheck the whether the **gzsetparams** API is called and pass in the correct compression level and compression strategy.
145e41f4b71Sopenharmony_ci
146e41f4b71Sopenharmony_ci## 17800007 Incorrect Input Buffer
147e41f4b71Sopenharmony_ci
148e41f4b71Sopenharmony_ci**Error Message**
149e41f4b71Sopenharmony_ci
150e41f4b71Sopenharmony_ciBuffer error.
151e41f4b71Sopenharmony_ci
152e41f4b71Sopenharmony_ci**Description**
153e41f4b71Sopenharmony_ci
154e41f4b71Sopenharmony_ciThis error code is reported when the input buffer is incorrect when the **compress**, **compress2**, **uncompress**, or **uncompress2** API is called.
155e41f4b71Sopenharmony_ci
156e41f4b71Sopenharmony_ci**Possible Causes**
157e41f4b71Sopenharmony_ci
158e41f4b71Sopenharmony_ci1. When the **uncompress** or **uncompress2** API is called, the input buffer size is greater than the output buffer size after decompression.
159e41f4b71Sopenharmony_ci2. When the **compress** or **compress2** API is called, the input buffer size is greater than the output buffer size after compression.
160e41f4b71Sopenharmony_ci3. When the **compress**, **compress2**, **uncompress**, or **uncompress2** API is called, the input buffer size is 0.
161e41f4b71Sopenharmony_ci
162e41f4b71Sopenharmony_ci**Solution**
163e41f4b71Sopenharmony_ci
164e41f4b71Sopenharmony_ciIncrease the size of the corresponding buffer.
165e41f4b71Sopenharmony_ci
166e41f4b71Sopenharmony_ci## 17800009 Internal Structure Error
167e41f4b71Sopenharmony_ci
168e41f4b71Sopenharmony_ci**Error Message**
169e41f4b71Sopenharmony_ci
170e41f4b71Sopenharmony_ciInternal structure error.
171e41f4b71Sopenharmony_ci
172e41f4b71Sopenharmony_ci**Description**
173e41f4b71Sopenharmony_ci
174e41f4b71Sopenharmony_ciThis 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.
175e41f4b71Sopenharmony_ci
176e41f4b71Sopenharmony_ci**Possible Causes**
177e41f4b71Sopenharmony_ci
178e41f4b71Sopenharmony_ci1. The API for opening the **.gz** file is not called or fails to be called.
179e41f4b71Sopenharmony_ci2. When the API for opening the **.gz** file is called, the input file access mode is incorrect.
180e41f4b71Sopenharmony_ci3. When the **gzwrite** API is called, the length of the input uncompressed byte is 0.
181e41f4b71Sopenharmony_ci4. When the **gzfwrite** or **gzfread** API is called, the size or number of input data blocks is 0.
182e41f4b71Sopenharmony_ci5. When the **gzprintf** API is called, the input format descriptor and plain text are empty strings.
183e41f4b71Sopenharmony_ci6. When the **gzgets** API is called, the input **ArrayBuffer** is empty.
184e41f4b71Sopenharmony_ci7. When the **gzgetc** API is called, the **.gz** file is empty.
185e41f4b71Sopenharmony_ci
186e41f4b71Sopenharmony_ci**Solution**
187e41f4b71Sopenharmony_ci
188e41f4b71Sopenharmony_ci1. Check whether the API for opening the **.gz** file is not called or fails to be called.
189e41f4b71Sopenharmony_ci2. 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**).
190e41f4b71Sopenharmony_ci3. Check whether the input parameter is correct.
191