Skip to content

libc++abi: terminating due to uncaught exception of type facebook::jsi::JSINativeException: Compiling JS failed: 1:1:invalid empty parentheses '( )' #3570

@atharshafi

Description

@atharshafi
  1. I tap Detect Face (which sets showCamera = true).
  2. The camera preview opens using react-native-vision-camera.
  3. All buttons in the overlay stop responding — including the Cancel button.
  4. I check the logs and see the following crash:

libc++abi: terminating due to uncaught exception of type facebook::jsi::JSINativeException: Compiling JS failed: 1:1:invalid empty parentheses '( )'

I suspect the crash is related to how the frameProcessor function is handled.
The error Compiling JS failed: 1:1: invalid empty parentheses '( )' suggests that the 'worklet' directive inside useFrameProcessor() is not being compiled correctly.

My frameProcessor uses 'worklet' and runOnJS() like this:

//frameProcessor code

// Face detection callback
const updateFaceDetection = Worklets.createRunOnJS((detected: boolean) => {
setFaceDetected(detected);
});

// Frame processor
const frameProcessor = useFrameProcessor((frame) => {
'worklet';
try {
const faces = detectFaces(frame);
updateFaceDetection(faces.length > 0);
} catch (error) {
updateFaceDetection(false);
}
}, []);

Full build logs

INFO: Created TensorFlow Lite XNNPACK delegate for CPU.
14:43:19.764: [info] 📸 VisionCamera.didSetProps(_:): Updating 23 props: [onInitialized, cameraId, position, enableBufferCompression, preview, onStarted, onCodeScanned, top, onOutputOrientationChanged, right, isActive, isMirrored, onViewReady, onError, onStopped, onPreviewOrientationChanged, onPreviewStarted, enableFrameProcessor, onPreviewStopped, left, bottom, photo, onShutter]
14:43:19.766: [info] 📸 VisionCamera.configurePreviewOrientation(_:): Updating Preview rotation: portrait...
14:43:19.766: [info] 📸 VisionCamera.configureOutputOrientation(_:): Updating Outputs rotation: portrait...
14:43:19.767: [info] 📸 VisionCamera.configure(_:): configure { ... }: Waiting for lock...
14:43:19.770: [info] 📸 VisionCamera.configure(_:): configure { ... }: Updating CameraSession Configuration... Difference(inputChanged: true, outputsChanged: true, videoStabilizationChanged: true, orientationChanged: true, formatChanged: true, sidePropsChanged: true, torchChanged: true, zoomChanged: true, exposureChanged: true, audioSessionChanged: true, locationChanged: true)
14:43:19.770: [info] 📸 VisionCamera.configureDevice(configuration:): Configuring Input Device...
14:43:19.770: [info] 📸 VisionCamera.configureDevice(configuration:): Configuring Camera com.apple.avfoundation.avcapturedevice.built-in_video:1...
14:43:19.772: [info] 📸 VisionCamera.configureDevice(configuration:): Successfully configured Input Device!
14:43:19.772: [info] 📸 VisionCamera.configureOutputs(configuration:): Configuring Outputs...
14:43:19.772: [info] 📸 VisionCamera.configureOutputs(configuration:): Adding Photo output...
14:43:19.774: [info] 📸 VisionCamera.configureOutputs(configuration:): Adding Video Data output...
14:43:19.775: [info] 📸 VisionCamera.configureOutputs(configuration:): AVCaptureVideoDataOutput will rotate Frames to landscapeRight...
14:43:19.775: [info] 📸 VisionCamera.configurePreviewOrientation(_:): Updating Preview rotation: portrait...
14:43:19.775: [info] 📸 VisionCamera.configureOutputOrientation(_:): Updating Outputs rotation: portrait...
14:43:19.775: [info] 📸 VisionCamera.configureOutputs(configuration:): Successfully configured all outputs!
14:43:19.776: [info] 📸 VisionCamera.setTargetOutputOrientation(_:): Setting target output orientation from device to device...
14:43:19.777: [info] 📸 VisionCamera.getPixelFormat(for:): Available Pixel Formats: ["420v", "420f", "BGRA", "&8v0", "-8v0", "&8f0", "-8f0", "&BGA", "-BGA"], finding best match... (pixelFormat="yuv", enableHdr={false}, enableBufferCompression={false})
14:43:19.777: [info] 📸 VisionCamera.getPixelFormat(for:): Using PixelFormat: 420f...
14:43:20.259: [info] 📸 VisionCamera.init(frame:session:): Preview Layer started previewing.
14:43:20.260: [info] 📸 VisionCamera.configure(_:): Beginning AudioSession configuration...
14:43:20.260: [info] 📸 VisionCamera.configureAudioSession(configuration:): Configuring Audio Session...
14:43:20.261: [info] 📸 VisionCamera.configure(_:): Committed AudioSession configuration!
14:43:20.263: [info] 📸 VisionCamera.configure(_:): Beginning Location Output configuration...
libc++abi: terminating due to uncaught exception of type facebook::jsi::JSINativeException: Compiling JS failed: 1:1:invalid empty parentheses '( )'

Project dependencies

{
  "name": "MyApp",
  "version": "0.0.1",
  "private": true,
  "scripts": {
    "android": "react-native run-android",
    "ios": "react-native run-ios",
    "lint": "eslint .",
    "start": "react-native start",
    "test": "jest"
  },
  "dependencies": {
    "@aws-amplify/react-native": "^1.1.10",
    "@react-native-async-storage/async-storage": "^2.1.2",
    "@react-native-community/datetimepicker": "^8.4.1",
    "@react-native-community/geolocation": "^3.4.0",
    "@react-native-community/netinfo": "^11.4.1",
    "@react-native-picker/picker": "^2.11.0",
    "@react-navigation/drawer": "^7.3.12",
    "@react-navigation/native": "^7.1.9",
    "@react-navigation/stack": "^7.3.2",
    "aws-amplify": "^6.15.0",
    "axios": "^1.9.0",
    "geolib": "^3.3.4",
    "haversine": "^1.1.1",
    "install": "^0.13.0",
    "moment": "^2.30.1",
    "npm": "^11.4.2",
    "react": "19.0.0",
    "react-native": "0.79.2",
    "react-native-camera": "^4.2.1",
    "react-native-circular-progress": "^1.4.1",
    "react-native-country-picker-modal": "^2.0.0",
    "react-native-dropdown-picker": "^5.4.6",
    "react-native-exception-handler": "^2.10.10",
    "react-native-geocoding": "^0.5.0",
    "react-native-geolocation-service": "5.3.1",
    "react-native-gesture-handler": "^2.25.0",
    "react-native-image-crop-picker": "^0.42.0",
    "react-native-keyboard-aware-scroll-view": "^0.9.5",
    "react-native-linear-gradient": "^2.8.3",
    "react-native-maps": "^1.23.8",
    "react-native-material-tabs": "^4.2.0",
    "react-native-modalize": "^2.1.1",
    "react-native-paper": "^5.14.5",
    "react-native-permissions": "^5.4.0",
    "react-native-progress": "^5.0.1",
    "react-native-reanimated": "^3.17.5",
    "react-native-restart": "^0.0.27",
    "react-native-safe-area-context": "^5.4.1",
    "react-native-segmented-control-tab": "^4.0.0",
    "react-native-simple-toast": "^3.3.2",
    "react-native-svg": "^15.12.0",
    "react-native-uuid-generator": "^6.1.1",
    "react-native-vector-icons": "^10.2.0",
    "react-native-vision-camera": "^4.7.0",
    "react-native-vision-camera-face-detector": "^1.8.6",
    "react-native-worklets-core": "^1.6.0",
    "react-redux": "^9.2.0",
    "redux": "^5.0.1",
    "redux-persist": "^6.0.0",
    "redux-saga": "^1.1.3",
    "reduxsauce": "^2.0.0"
  },
  "devDependencies": {
    "@babel/core": "^7.25.2",
    "@babel/preset-env": "^7.25.3",
    "@babel/preset-typescript": "^7.27.1",
    "@babel/runtime": "^7.25.0",
    "@react-native-community/cli": "18.0.0",
    "@react-native-community/cli-platform-android": "18.0.0",
    "@react-native-community/cli-platform-ios": "18.0.0",
    "@react-native/babel-preset": "^0.79.2",
    "@react-native/eslint-config": "0.79.2",
    "@react-native/metro-config": "0.79.2",
    "@react-native/typescript-config": "0.79.2",
    "@types/jest": "^29.5.13",
    "@types/react": "^19.1.6",
    "@types/react-native": "^0.72.8",
    "@types/react-test-renderer": "^19.0.0",
    "babel-plugin-module-resolver": "^5.0.2",
    "eslint": "^8.19.0",
    "jest": "^29.6.3",
    "prettier": "2.8.8",
    "react-test-renderer": "19.0.0",
    "typescript": "^5.0.4"
  },
  "engines": {
    "node": ">=18"
  },
}

VisionCamera Version

4.7.0

Target platforms

iOS

Operating system

MacOS

Can you build the VisionCamera Example app?

I didn't try (⚠️ your issue might get ignored & closed if you don't try this)

Additional information

Metadata

Metadata

Assignees

No one assigned

    Labels

    🔧 build errorIssue is related to building VisionCamera in your project

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions