Skip to content

Pod install fails: invalid byte sequence in UTF-8 in new_architecture.rb when plist is not UTF-8 #52864

@vijay-subramani

Description

@vijay-subramani

Description

When running pod install in a React Native iOS project, it crashes during the post-install hook with:
An error occurred while processing the post-install hook of the Podfile. invalid byte sequence in UTF-8

Stack trace:
/.../xcodeproj-1.27.0/lib/xcodeproj/plist.rb:91:in match'
/.../xcodeproj/plist.rb:91:in file_in_conflict?' /.../xcodeproj/plist.rb:20:in read_from_path'
/node_modules/react-native/scripts/cocoapods/new_architecture.rb:181:in block in set_RCTNewArchEnabled_in_info_plist'

React Native version:
react-native: 0.80.1 cocoapods: 1.16.2 ruby: 3.1.0 xcodeproj: 1.27.0

the same worked with my demo project where i dont have any other post install hooks.

Steps to reproduce

  1. Add react native dependencies into your existing project's pod file.
  2. some post install hooks needs to be there other than react native hooks
  3. try doing pod install you'll get this issue

React Native Version

0.80.1

Affected Platforms

Build - MacOS

Output of npx @react-native-community/cli info

...
npm warn cli npm v11.4.2 does not support Node.js v21.7.1. This version of npm supports the following node versions: `^20.17.0 || >=22.9.0`. You can find the latest version at https://nodejs.org/.
info Fetching system and libraries information...
System:
  OS: macOS 15.5
  CPU: (10) arm64 Apple M1 Pro
  Memory: 118.95 MB / 16.00 GB
  Shell:
    version: "5.9"
    path: /bin/zsh
Binaries:
  Node:
    version: 21.7.1
    path: /usr/local/bin/node
  Yarn:
    version: 1.22.22
    path: /usr/local/bin/yarn
  npm:
    version: 11.4.2
    path: /usr/local/bin/npm
  Watchman:
    version: 2025.06.30.00
    path: /usr/local/bin/watchman
Managers:
  CocoaPods:
    version: 1.16.2
    path: /Users/vijaysubramani/.rvm/gems/ruby-3.1.0/bin/pod
SDKs:
  iOS SDK:
    Platforms:
      - DriverKit 24.5
      - iOS 18.5
      - macOS 15.5
      - tvOS 18.5
      - visionOS 2.5
      - watchOS 11.5
  Android SDK: Not Found
IDEs:
  Android Studio: 2024.2 AI-242.23339.11.2421.12700392
  Xcode:
    version: 16.4/16F6
    path: /usr/bin/xcodebuild
Languages:
  Java:
    version: 21.0.7
    path: /usr/bin/javac
  Ruby:
    version: 3.1.0
    path: /Users/vijaysubramani/.rvm/rubies/ruby-3.1.0/bin/ruby
npmPackages:
  "@react-native-community/cli": Not Found
  react: Not Found
  react-native: Not Found
  react-native-macos: Not Found
npmGlobalPackages:
  "*react-native*": Not Found
Android:
  hermesEnabled: Not found
  newArchEnabled: Not found
iOS:
  hermesEnabled: false
  newArchEnabled: true

info React Native v0.80.2 is now available (your project is running on v0.80.1).
info Changelog: https://github.com/facebook/react-native/releases/tag/v0.80.2
info Diff: https://react-native-community.github.io/upgrade-helper/?from=0.80.1&to=0.80.2
info For more info, check out "https://reactnative.dev/docs/upgrading?os=macos".
...

Stacktrace or Logs

An error occurred while processing the post-install hook of the Podfile.

invalid byte sequence in UTF-8

/Users/vijaysubramani/.rvm/gems/ruby-3.1.0/gems/xcodeproj-1.27.0/lib/xcodeproj/plist.rb:91:in match'
/Users/vijaysubramani/.rvm/gems/ruby-3.1.0/gems/xcodeproj-1.27.0/lib/xcodeproj/plist.rb:91:in match'
/Users/vijaysubramani/.rvm/gems/ruby-3.1.0/gems/xcodeproj-1.27.0/lib/xcodeproj/plist.rb:91:in file_in_conflict?'
/Users/vijaysubramani/.rvm/gems/ruby-3.1.0/gems/xcodeproj-1.27.0/lib/xcodeproj/plist.rb:20:in read_from_path'
/Users/vijaysubramani/Documents/Projects/ios-retail/ios-retail/node_modules/react-native/scripts/cocoapods/new_architecture.rb:181:in block (2 levels) in set_RCTNewArchEnabled_in_info_plist'
/Users/vijaysubramani/Documents/Projects/ios-retail/ios-retail/node_modules/react-native/scripts/cocoapods/new_architecture.rb:170:in each'
/Users/vijaysubramani/Documents/Projects/ios-retail/ios-retail/node_modules/react-native/scripts/cocoapods/new_architecture.rb:170:in block in set_RCTNewArchEnabled_in_info_plist'
/Users/vijaysubramani/Documents/Projects/ios-retail/ios-retail/node_modules/react-native/scripts/cocoapods/new_architecture.rb:165:in each'
/Users/vijaysubramani/Documents/Projects/ios-retail/ios-retail/node_modules/react-native/scripts/cocoapods/new_architecture.rb:165:in set_RCTNewArchEnabled_in_info_plist'
/Users/vijaysubramani/Documents/Projects/ios-retail/ios-retail/node_modules/react-native/scripts/react_native_pods.rb:464:in react_native_post_install'
/Users/vijaysubramani/Documents/Projects/ios-retail/ios-retail/CaratLane_Retail/Podfile:118:in block (2 levels) in from_ruby'
/Users/vijaysubramani/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-core-1.16.2/lib/cocoapods-core/podfile.rb:196:in post_install!'
/Users/vijaysubramani/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.16.2/lib/cocoapods/installer.rb:1013:in run_podfile_post_install_hook'
/Users/vijaysubramani/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.16.2/lib/cocoapods/installer.rb:1001:in block in run_podfile_post_install_hooks'
/Users/vijaysubramani/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.16.2/lib/cocoapods/user_interface.rb:149:in message'
/Users/vijaysubramani/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.16.2/lib/cocoapods/installer.rb:1000:in run_podfile_post_install_hooks'
/Users/vijaysubramani/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.16.2/lib/cocoapods/installer.rb:337:in block (2 levels) in create_and_save_projects'
/Users/vijaysubramani/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.16.2/lib/cocoapods/installer/xcode/pods_project_generator/pods_project_writer.rb:61:in write!'
/Users/vijaysubramani/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.16.2/lib/cocoapods/installer.rb:336:in block in create_and_save_projects'
/Users/vijaysubramani/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.16.2/lib/cocoapods/user_interface.rb:64:in section'
/Users/vijaysubramani/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.16.2/lib/cocoapods/installer.rb:315:in create_and_save_projects'
/Users/vijaysubramani/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.16.2/lib/cocoapods/installer.rb:307:in generate_pods_project'
/Users/vijaysubramani/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.16.2/lib/cocoapods/installer.rb:183:in integrate'
/Users/vijaysubramani/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.16.2/lib/cocoapods/installer.rb:170:in install!'
/Users/vijaysubramani/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.16.2/lib/cocoapods/command/install.rb:52:in run'
/Users/vijaysubramani/.rvm/gems/ruby-3.1.0/gems/claide-1.1.0/lib/claide/command.rb:334:in run'
/Users/vijaysubramani/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.16.2/lib/cocoapods/command.rb:52:in run'
/Users/vijaysubramani/.rvm/rubies/ruby-3.1.0/lib/ruby/gems/3.1.0/gems/cocoapods-1.16.2/bin/pod:55:in <top (required)>'
/Users/vijaysubramani/.rvm/gems/ruby-3.1.0/bin/pod:25:in load'
/Users/vijaysubramani/.rvm/gems/ruby-3.1.0/bin/pod:25:in <main>'
/Users/vijaysubramani/.rvm/gems/ruby-3.1.0/bin/ruby_executable_hooks:22:in eval'
/Users/vijaysubramani/.rvm/gems/ruby-3.1.0/bin/ruby_executable_hooks:22:in <main>'

MANDATORY Reproducer

https://github.com/vijay-subramani/invalidByteIssueReproducer/tree/main/ReproducerApp/ios

Screenshots and Videos

I've added the reproducer repo. But there it is working fine. Need to check this. in my main project it's not working. My main project having appclip, notification service targets too.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions