Repository navigation
Closed
Labels
enhancementNew feature or requestNew feature or request
Milestone
Description
Problem
When CloudKit record operations fail (e.g., in batch modifyRecords calls), the RecordInfo structure loses the detailed error information from the CloudKit API response.
Current behavior:
- CloudKit API returns errors with
serverErrorCodeandreasonfields RecordInfoonly exposes:recordName,recordType,recordChangeTag,fields- Failed operations set
recordType = "Unknown"for error detection viaisErrorproperty - The actual error details (
serverErrorCode,reason) are lost
Impact:
When debugging failed CloudKit operations, developers cannot see what went wrong. For example:
- ACCESS_DENIED errors
- VALIDATING_REFERENCE_ERROR
- Schema mismatches
- Invalid field values
All appear the same: recordType == "Unknown" with no error details.
Proposed Solution
Option 1: Extend RecordInfo to include error details
public struct RecordInfo {
public let recordName: String
public let recordType: String
public let recordChangeTag: String?
public let fields: [String: FieldValue]
// Add error information
public let serverErrorCode: String?
public let reason: String?
public var isError: Bool {
serverErrorCode != nil
}
}Option 2: Add verbose logging in CloudKitResponseProcessor
Log error details before converting to RecordInfo:
internal func processModifyRecordsResponse(_ response: Operations.modifyRecords.Output)
async throws(CloudKitError) -> Components.Schemas.ModifyResponse
{
// Log individual record errors before conversion
if let records = modifyResponse.records {
for record in records where record.recordType == nil {
MistKitLogger.logError(
"Record operation failed - serverErrorCode: \(record.serverErrorCode ?? "unknown"), reason: \(record.reason ?? "unknown")",
logger: MistKitLogger.api
)
}
}
return modifyResponse
}Option 3: Add separate error result type
public enum RecordResult {
case success(RecordInfo)
case failure(serverErrorCode: String, reason: String, recordName: String?)
}
public func modifyRecords(_ operations: [RecordOperation]) async throws -> [RecordResult]Use Case
This issue was discovered while debugging BushelCloud sync failures where all 243 RestoreImage records failed with no visible error information, making it impossible to diagnose the root cause.
Priority
Medium - This makes debugging CloudKit integration much harder than necessary.
Reacted by coderabbitai
Metadata
Metadata
Assignees
Labels
enhancementNew feature or requestNew feature or request
Activity
coderabbitai commentedon Dec 23, 2025
📝 CodeRabbit Plan Mode
Generate an implementation plan and prompts that you can use with your favorite coding agent.
Examples
🔗 Similar Issues
Related Issues
🔗 Related PRs
#132 - Adding Bushel Example [merged]
👤 Suggested Assignees
🧪 Issue enrichment is currently in open beta.
You can configure auto-planning by selecting labels in the issue_enrichment configuration.
To disable automatic issue enrichment, add the following to your
.coderabbit.yaml:💬 Have feedback or questions? Drop into our discord or schedule a call!
leogdion commentedon Jan 8, 2026
✅ Closing as completed. Comprehensive verbose error logging has been implemented for failed record operations:
QueryRecords (lines 256-323 in CloudKitService+Operations.swift):
All Operations:
The logging uses MistKitLogger with appropriate subsystems (api, network) and includes shouldRedact flags for privacy control. Error messages provide actionable debugging information.