This section describes only module-specific error codes. For details about universal error codes, please refer to Universal Error Codes.
Scan Kit reports different error information based on the actual error cause. The details are as follows:
Error Message
Internal error. Failed to encode.
Error Description
Failed to generate the barcode image.
Possible Causes
An algorithm error occurs during barcode image generation.
Solution
Call the barcode image generation API createBarcode again.
Error Message
Internal error. Failed to decode.
Error Description
Failed to recognize barcodes in an image.
Possible Causes
An algorithm error occurs during barcode recognition in an image.
Solution
Call the decode API for barcode recognition in an image again.
Error Message
Internal error. Failed to decode image.
Error Description
Failed to recognize barcodes from image data.
Possible Causes
An algorithm error occurs during barcode recognition from image data.
Solution
Call the decodeImage API for barcode recognition from image data again.
Error Message
Internal error. Failed to create pixelMap.
Error Description
Failed to create pixelMap during barcode image generation.
Possible Causes
The logic for the system to create an image is abnormal.
Solution
Call the barcode image generation API createBarcode again.
Error Message
Internal error. Failed to read file.
Error Description
Failed to read the passed image path during barcode recognition in an image.
Possible Causes
The URI passed by the developer is invalid.
Solution
Check the passed URI.
Error Message
Internal error. Get context failed.
Error Description
Failed to obtain the system context during barcode scanning by default UI.
Possible Causes
The passed context is incorrect.
Solution
Check the input parameter context by referring to Obtaining UIAbilityContext.
Error Message
Internal error. Get UI content failed.
Error Description
Failed to obtain the UI content during barcode scanning by default UI.
Possible Causes
The passed context is incorrect. As a result, the UI content fails to be obtained.
Solution
Check the input parameter context by referring to Obtaining UIAbilityContext.
Error Message
Internal error. Get callback failed.
Error Description
Failed to obtain the callback.
Possible Causes
The external callback is abnormal.
Solution
Check the callback input parameter.
Error Message
Internal error. This interface must be invoked after the customScan.start interface.
Error Description
The API call sequence is incorrect. The start API is not called before the current API is called.
Possible Causes
APIs are not called based on the service process. For example, the getFlashLightStatus API is directly called without calling the start API first.
Solution
Adjust the API call sequence. For details, please refer to Flowchart of scanning on a custom UI. For example, call the start API and then the getFlashLightStatus API.
Error Message
Internal error. This interface cannot be used after the camera session is paused.
Error Description
The API call sequence is incorrect. The stop API is called before the current API.
Possible Causes
APIs are not called based on the service process. For example, the getFlashLightStatus API is called after the stop API is called.
Solution
Adjust the API call sequence. For details, please refer to Flowchart of scanning on a custom UI. For example, before calling the getFlashLightStatus API, ensure that the stop API is not called.
Error Message
Internal error. ScanOption is null, please call customScan.init first.
Error Description
The API call sequence is incorrect. The init API is not called before the start API.
Possible Causes
The init API is not called before the start API.
Solution
Adjust the API call sequence. For details, please refer to Flowchart of scanning on a custom UI. Call the init API before calling the start API.
Error Message
Internal error. The interface can't be used in promise interface.
Error Description
This API cannot be called in the promise mode of start.
Possible Causes
The rescan API is called in the promise mode of start.
Solution
Error Message
Internal error. CustomScan stop session failed.
Error Description
Camera error.
Possible Causes
Failed to stop the barcode scanning camera stream.
Solution
Check whether the barcode scanning camera stream has been started. If not, create a barcode scanning camera stream again. Check whether the barcode scanning camera stream has been stopped.
Error Message
Internal error. CustomScan release failed.
Error Description
Camera error.
Possible Causes
Failed to release the barcode scanning camera stream.
Solution
Check whether the barcode scanning camera stream has been started. If not, create a barcode scanning camera stream again. Check whether the barcode scanning camera stream has been released.
Error Message
Internal error. Open camera flash failed, flashlight is not available.
Error Description
Failed to turn on the flash light.
Possible Causes
The flash light is unavailable.
Solution
Check whether the flash light of the device is normal.
Error Message
Internal error. Close camera flash failed, flashlight is not available.
Error Description
Failed to turn off the flash light.
Possible Causes
The flash light is unavailable.
Solution
Check whether the flash light of the device is normal.
Error Message
Internal error. Camera setZoom failed.
Error Description
Failed to set the zoom ratio.
Possible Causes
The camera is abnormal.
Solution
Check whether the barcode scanning camera stream has been started. If not, create a barcode scanning camera stream again.
Error Message
Internal error. Camera getZoom failed.
Error Description
Failed to obtain the zoom ratio.
Possible Causes
The camera is abnormal.
Solution
Check whether the barcode scanning camera stream has been started. If not, create a barcode scanning camera stream again.
Error Message
Internal error. Camera setFocusPoint failed.
Error Description
Failed to set the camera focal point.
Possible Causes
The camera is abnormal.
Solution
Check whether the barcode scanning camera stream has been started. If not, create a barcode scanning camera stream again.
Error Message
Internal error. Reset focus mode failed.
Error Description
Failed to set the continuous autofocus mode.
Possible Causes
The camera is abnormal.
Solution
Check whether the barcode scanning camera stream has been started. If not, create a barcode scanning camera stream again.
Error Message
Internal error. Camera config captureSession failed.
Error Description
The camera is abnormal.
Possible Causes
Failed to configure the stream for the camera.
Solution
Try to release the barcode scanning camera stream and then create the service again.
Error Message
Internal error. Camera create cameraManager failed.
Error Description
The camera is abnormal.
Possible Causes
Failed to create cameraManager.
Solution
Try to release the barcode scanning camera stream and then create the service again.
Error Message
Internal error. Camera create camera session failed.
Error Description
The camera is abnormal.
Possible Causes
Failed to create a session.
Solution
Try to release the barcode scanning camera stream and then create the service again.
Error Message
Internal error. Camera restart camera session failed.
Error Description
The camera is abnormal.
Possible Causes
Failed to restart the camera.
Solution
Try to release the barcode scanning camera stream and then create the service again.
Error Message
Internal error. Camera create preview output failed.
Error Description
The camera is abnormal.
Possible Causes
Failed to create a preview stream.
Solution
Try to release the barcode scanning camera stream and then create the service again.
Error Message
Internal error. Camera get supported output capability failed.
Error Description
The camera is abnormal.
Possible Causes
Failed to obtain the output capability supported by a specified camera.
Solution
Try to release the barcode scanning camera stream and then create the service again.
Error Message
Internal error. Capability not supported. Failed to call the API due to limited device capabilities.
Error Description
The device does not support this API. Therefore, it cannot be called properly.
Possible Causes
The device supports the SysCap associated with the API but does not support the API itself.
Solution
Avoid using this API on the device. Alternatively, implement conditional checks in your code to mitigate the impacts arising from the app running on different devices, particularly under abnormal circumstances.
Error Message
The user canceled the barcode scanning.
Error Description
The user cancels the scanning.
Possible Causes
The user taps the close button or swipes to cancel the scanning on the default screen.
Solution
This error code is returned when startScanForResult is used. Handle the service process after the user cancels the scanning on the default screen based on the application scenario.