Skip to content

🐛 Failed to save codable to cache: Error Domain=NSCocoaErrorDomain Code=4 "The file ... doesn't exist" #5985

@esamelson

Description

@esamelson

Describe the bug

I just upgraded from 5.48.0 to 5.51.1, and I'm consistently seeing the following two errors happen on each app load as soon as RevenueCat is configured:

Failed to save codable to cache: Error Domain=NSCocoaErrorDomain Code=4 "The file “com.revenuecat.userdefaults.productEntitlementMapping” doesn’t exist." UserInfo={NSFilePath=..., NSURL=..., NSUnderlyingError=0x600002cbd290 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

Failed to save codable to cache: Error Domain=NSCocoaErrorDomain Code=4 "The file “com.revenuecat.userdefaults.offerings.<offering-id>” doesn’t exist." UserInfo={NSFilePath=..., NSURL=..., NSUnderlyingError=0x6000024d8e10 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

So far I have only seen this on the "My Mac (Designed for iPad)" Xcode development build, but it happens consistently and is concerning, and adds these error messages to my debug UI (I'm using react-native-purchases).

Platform

macOS

SDK version

5.51.1

SDK integration method

CocoaPods

StoreKit version

StoreKit 2 (default on versions >=5.0.0)

OS version

macOS 15.7.1

Xcode version

26.0.1

Device and/or simulator

Simulator

Environment

Sandbox

How widespread is the issue

100% of development devices so far

Debug logs

[RevenueCat] ℹ️ ProductEntitlementMapping cache updated from network.
[RevenueCat] 😿‼️ Failed to save codable to cache: Error Domain=NSCocoaErrorDomain Code=4 "The file “com.revenuecat.userdefaults.productEntitlementMapping” doesn’t exist." UserInfo={NSFilePath=<build-dir>/Data/Documents/RevenueCat/com.revenuecat.userdefaults.productEntitlementMapping, NSURL=file://<build-dir>/Data/Documents/RevenueCat/com.revenuecat.userdefaults.productEntitlementMapping, NSUnderlyingError=0x60000277d020 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

[RevenueCat] 😻 Offerings updated from network.
[RevenueCat] 😿‼️ Failed to save codable to cache: Error Domain=NSCocoaErrorDomain Code=4 "The file “com.revenuecat.userdefaults.offerings.<offering-id>” doesn’t exist." UserInfo={NSFilePath=<build-dir>/Data/Documents/RevenueCat/com.revenuecat.userdefaults.offerings.<offering-id>, NSURL=file://<build-dir>/Data/Documents/RevenueCat/com.revenuecat.userdefaults.offerings.<offering-id>, NSUnderlyingError=0x60000276dc80 {Error Domain=NSPOSIXErrorDomain Code=2 "No such file or directory"}}

Steps to reproduce

  1. Call Purchases.configure() from react-native-purchases
  2. Observe errors in log and in react native debug UI

Other information

Again, this issue was not present in 5.48.0 but is present in 5.51.1.

Looking through your commit history I noticed these changes and wondered if either might be relevant: https://github.com/RevenueCat/purchases-ios/commit/f033ddc398ab362a3848b286c048723aae61e03e https://github.com/RevenueCat/purchases-ios/commit/ba4a7291ecd75e75df8a0747a97089b11cffa906

Additional context

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions