This topic describes only module-specific error codes. For details about universal error codes, see Universal Error Codes.
Error Message
The value of ${param} is out of range.
Description
The value of a parameter passed in the API exceeds the valid range.
Possible Causes
The parameter value exceeds the value range.
Solution
Use a valid parameter value.
Error Message
Invalid ${param} string.
Description
Failed to parse a string.
Possible Causes
A parameter of the string type passed in the API is a non-standard string. As a result, the string fails to be parsed.
Solution
Check the format of the string.
Error Message
Worker initialization failed.
Description
The Worker instance fails to be initialized when the API is called.
Possible Causes
Solution
Error Message
The Worker instance is not running.
Description
The Worker instance is not running when the API is called.
Possible Causes
When the API is called, the Worker instance has been destroyed or is being destroyed.
Solution
Ensure that the Worker instance is running properly.
Error Message
The called API is not supported in the worker thread.
Description
An API that is not supported by the worker thread is called.
Possible Causes
The worker thread does not support the API.
Solution
Use a supported API.
Error Message
An exception occurred during serialization.
Description
An error occurs during serialization.
Possible Causes
The type of data to transfer does not support serialization or is imported externally.
Solution
Ensure that the data to transfer is a valid serialized object supported by Worker. For details, see Overview of ArkTS Inter-Thread Communication.
Error Message
The worker file path is invalid.
Description
The file path is invalid, and the Worker instance cannot be loaded.
Possible Causes
The worker file path is invalid.
Solution
Ensure that the worker file path complies with the specifications for creating Worker instances. For details, see the example under constructor9+.
Error Message
The buffer size must be a multiple of ${size}.
Description
The buffer size does not meet the requirement.
Possible Causes
The buffer size is not an integer multiple of size, which can be 16-bit, 32-bit, or 64-bit.
Solution
Use a buffer the size of which meets the requirements.
Error Message
Container is empty.
Description
The container to be operated is empty.
Possible Causes
No element is added to the container.
Solution
Add elements to the container first.
Error Message
The {methodName} method cannot be bound.
Description
this.object passed in the API is not an instance of the containers class.
Possible Causes
The APIs of the containers class do not support bind().
Solution
Error Message
The {className}'s constructor cannot be directly invoked.
Description
A constructor of the containers class is called directly to create an instance.
Possible Causes
The constructors of the containers class cannot be directly called. The keyword new must be used.
Solution
Use the keyword new to create an instance.
Error Message
${propertyName} cannot be set for the buffer that has only a getter.
Description
The buffer ${propertyName} is read-only and cannot be set.
Possible Causes
The buffer is read-only.
Solution
Do not set the read-only attribute for the buffer.
Error Message
The function is not marked as concurrent.
Description
The function is not marked as concurrent.
Possible Causes
@Concurrent is not added to the function required by the task to be executed in the task pool.
Solution
Check the functions required by the tasks executed by the task pool and add the @Concurrent decorator.
Error Message
The task to cancel does not exist.
Description
This error code is reported when you attempt to cancel a task that does not exist.
Possible Causes
The task to cancel does not exist in the task pool.
Solution
Before canceling a task, ensure that the task has been placed in the task pool by calling taskpool.execute and is not finishing. If you are not sure, capture exceptions.
Error Message
The task to cancel is being executed.
Description
This error code is reported when you attempt to cancel a task that is being executed.
Possible Causes
The task to cancel is being executed.
Solution
Before canceling a task, ensure that the task has been placed in the task pool by calling taskpool.execute and has not started execution. If you are not sure, capture exceptions.
Error Message
The element does not exist in this container.
Description
This error code is reported when you attempt to delete an element that does not exist in the container.
Possible Causes
The element to delete does not exist in the container.
Solution
Before deleting an element, ensure that the element exists in this container.
Error Message
The task group to cancel does not exist.
Description
This error code is reported when you attempt to cancel a task group that does not exist.
Possible Causes
The task group to cancel does not exist in the task pool.
Solution
Before canceling a task group, ensure that the task group placed in the task pool by calling taskpool.execute and is not finishing. If you are not sure, capture exceptions.
Error Message
The globalCallObject is not registered.
Description
This error code is reported when you attempt to call an API of an object that is not registered.
Possible Causes
The object with the specified name is not registered or has been destroyed on the Worker instance of the host thread.
Solution
Do not call the API on the object that is not registered or has been destroyed. If the registration or destruction status cannot be determined, use the try-catch mechanism to call the API.
Error Message
The method to be called is not callable or is an async method or a generator.
Description
This error code is reported when you attempt to call an API of an incorrect type on a registered object.
Possible Causes
The attribute contained in the object is not callable, the method contained in the object is asynchronous, or the object is returned by the generator function.
Solution
Ensure that the attribute contained in the method is callable and that the method itself or its underlying layer is not asynchronous.
Error Message
Waiting for a global call timed out.
Description
This error code is reported when a global call does not return any value within the specified duration.
Possible Causes
The global call does not return any value within the specified duration, which is 5000 ms by default.
Solution
Do not call APIs that take a long time to process data, such as complex computing and file read/write. Otherwise, worker threads will be blocked for a long time, resulting in poor running performance.
Error Message
The function is not called in the TaskPool thread.
Description
This error code is reported when the function is not called in a TaskPool thread.
Possible Causes
The function is called in the UI main thread or in a thread that is not in TaskPool.
Solution
Ensure that concurrent functions are executed in a TaskPool thread. If you are not sure, capture exceptions.
Error Message
The function is not called in the concurrent function.
Description
This error code is reported when the function is not called in a concurrent function.
Possible Causes
The function is called in a callback function.
Solution
Ensure that the function is called in a concurrent function. If you are not sure, capture exceptions.
Error Message
The callback is not registered on the host side.
Description
This error code is reported when this function is called without registering a callback in the host thread.
Possible Causes
This function is called without registering a callback in the host thread.
Solution
Ensure that the callback has been registered in the host thread before this function is called. If you are not sure, capture exceptions.
Error Message
dependent task not allowed.
Description
A task that has dependent tasks cannot be added to the queue.
Possible Causes
The task to be added to the queue has dependent tasks.
Solution
Call removeDependency() to remove the dependent tasks first.
Error Message
There is a circular dependency.
Description
The current task has a cyclic dependency.
Possible Causes
The current task has a cyclic dependency.
Solution
Call removeDependency() to remove unnecessary dependencies.
Error Message
The dependency does not exist.
Description
removeDependency() is called to remove a dependent task, but the task does not exist.
Possible Causes
The dependent task to remove does not exist.
Solution
Ensure that the dependent task to remove has been added by using addDependency(). If you are not sure, capture exceptions.
Error Message
The delayTime is less than zero.
Description
This error code is reported when the value of delayTime is less than 0.
Possible Causes
The value of delayTime is less than 0.
Solution
Ensure that delayTime is set to a value greater than 0. If you are not sure, capture exceptions.
Error Message
An ArrayBuffer cannot be set as both a transfer list and a clone list.
Description
An ArrayBuffer cannot be set as both a transfer list and a clone list.
Possible Causes
During the transmission of a shared list, an ArrayBuffer is a parameter of both setTransferList and setCloneList.
Solution
Ensure that an ArrayBuffer is set as either a transfer list or clone list. If you are not sure, capture exceptions.
Error Message
The lock does not exist.
Description
The requested lock does not exist.
Possible Causes
An asynchronous lock function uses an incorrect lock name.
Solution
Ensure that the correct lock name is used when the API is called.
Error Message
Timeout exceeded.
Description
The lockAsync API fails to acquire a lock within the specified period.
Possible Causes
A deadlock occurs somewhere.
Solution
Check whether a circular dependency exists between locks. Add the catch statement to the lockAsync call to catch error information, which contains information about existing asynchronous lock instances and possible deadlock warnings.
Error Message
Concurrent modification error.
Description
An error occurs during concurrent modification.
Possible Causes
A non-concurrent-safe container provided by collections is used, and the result generated when multiple concurrent instances simultaneously modify the container is undefined.
Solution
Use asynchronous locks in non-concurrent-safe containers provided by collections.
Error Message
The executed task does not support the registration of listeners.
Description
The task does not support listener registration.
Possible Causes
The callback function is not registered or is registered after the task is executed.
Solution
Ensure that the callback function is registered before the task is executed.
Error Message
The doWrite method has not been implemented.
Description
The doWrite API is not implemented.
Possible Causes
The code inherits from the Writable class, but does not implement the doWrite API.
Solution
Implement the doWrite API in the inherited class.
Error Message
The stream has been ended.
Description
The write operation is still performed after the stream ends.
Possible Causes
Data is written after the end API is called.
Solution
Adjust the sequence in which the APIs are called to ensure that no write operation is performed after end.
Error Message
The callback is invoked multiple times consecutively.
Description
The callback is invoked multiple times.
Possible Causes
In the doWrite implementation code, the callback is invoked multiple times for one write operation.
Solution
Check the implementation of doWrite and exclude the situation where the callback is invoked multiple times for one write operation.
Error Message
The doRead method has not been implemented.
Description
The doRead API is not implemented.
Possible Causes
The code inherits from the Readable class, but does not implement the doRead API.
Solution
Implement the doRead API in the inherited class.
Error Message
The doTransform method has not been implemented for a class that inherits from Transform.
Description
The doTransform API is not implemented.
Possible Causes
The code inherits from the Transform class, but does not implement the doTransform API.
Solution
Implement the doTransform API in the inherited class.
Error Message
The concurrent task has been executed and cannot be executed periodically.
Description
The concurrent task that has been executed cannot be executed periodically.
Possible Causes
The task has been executed before executePeriodically is called.
Solution
Before calling the API, ensure that the task is not executed. If you are not sure, capture exceptions.
Error Message
The periodic task cannot be executed again.
Description
A periodic task cannot be executed again.
Possible Causes
execute, executeDelayed, addTask, or execute is called again to execute a periodic call.
Solution
Before calling these APIs, ensure that the task is not a periodic task. If you are not sure, capture exceptions.
Error Message
The periodic task cannot have a dependency.
Description
A periodic task cannot have dependencies.
Possible Causes
removeDependency or addDependency is called to remove or add dependencies for a periodic task.
Solution
Before calling these APIs, ensure that the task is not a periodic task. If you are not sure, capture exceptions.
Error Message
The asyncRunner task discarded.
Description
A task within the waiting list of the asynchronous queue is discarded.
Possible Causes
When the number of tasks executed by calling asyncRunner.execute exceeds the capacity of the waiting list, the earliest task in the list is discarded.
Solution
Error Message
The asyncRunner task has been canceled.
Description
The task in the asynchronous queue is canceled.
Possible Causes
The task is canceled when it is pending in the task pool for processing or when it is in the waiting list.
Solution
Before canceling a task, ensure that the task has been distributed to the task pool and started for execution. If you are not sure, capture exceptions.
Error Message
The task has been executed by AsyncRunner.
Description
An asynchronous queue task cannot have dependencies.
Possible Causes
removeDependency or addDependency is called to remove or add dependencies for an asynchronous queue task.
Solution
Before calling these APIs, ensure that the task is not an asynchronous queue task. If you are not sure, capture exceptions.
Error Message
The task cannot be executed by two APIs.
Description
Asynchronous queue tasks can be executed only by asyncRunner.execute, whereas non-asynchronous tasks cannot be executed by asyncRunner.execute.
Possible Causes
Solution
Error Message
Precision limit exceeded.
Description
A Decimal function is incorrectly used.
Possible Causes
The precision of the function provided by Decimal exceeds the limit. This error code may be thrown by the following functions: pow, exp, log, ln, acos, asin, atan, acosh, asinh, atanh, log2, log10, and atan2.
Solution
Use Decimal.set to set a valid precision.
Example: Decimal.set({precision: 10})
Error Message
The cumulative length of xml has exceeded the upper limit 100000.
Description
The cumulative length of XML characters has exceeded the upper limit of 100,000.
Possible Causes
The total length of parameters set in the called API exceeds the upper limit of 100,000.
Solution
Reduce the length of the parameters set in the current API.
Error Message
Illegal position for xml.
Description
The XML file declaration or attribute position is incorrect.
Possible Causes
The element positions are not set according to the XML standard format.
Solution
Set the element positions according to the XML standard.
Error Message
Cannot be an empty string.
Description
The input string cannot be empty.
Possible Causes
The input string is empty.
Solution
Provide a valid non-empty string as input.
Error Message
There is no match between the startElement and the endElement.
Description
The start tag and end tag of an element are not properly matched.
Possible Causes
The end tag is written before the start tag.
Solution
Write the start tag before the end tag.
Error Message
Incorrect encoding format, only support utf-8.
Description
The encoding format is incorrect. Only UTF-8 is supported.
Possible Causes
The encoding format is not UTF-8.
Solution
Change the encoding format to UTF-8.
Error Message
The underlying ArrayBuffer is null or detach.
Description
An ArrayBuffer that has been released or detached is being used.
Possible Causes
The ArrayBuffer has been detached, or the ArrayBuffer is null.
Solution
Ensure that the ArrayBuffer being used is available. If you are not sure, capture exceptions.
Error Message
Loading native module failed.
Description
This error code is returned when the native module fails to be loaded.
Possible Causes
Solution
Check whether the native module to be loaded is in the current package.