{"record":{"id":"fde0818fd2db54d7","repo":"siyuan-note/siyuan","slug":"failed-to-read-icloud-file-resource-status","errorCode":null,"errorMessage":"failed to read iCloud file resource status","messagePattern":"failed to read iCloud file resource status","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"kernel/util/icloud_darwin.go","lineNumber":61,"sourceCode":"\nimport (\n\t\"errors\"\n\t\"unsafe\"\n)\n\nfunc isUbiquitousItem(path string) (bool, error) {\n\tcPath := C.CString(path)\n\tdefer C.free(unsafe.Pointer(cPath))\n\n\tswitch C.siyuanIsUbiquitousItem(cPath) {\n\tcase 1:\n\t\treturn true, nil\n\tcase 0:\n\t\treturn false, nil\n\tcase -2:\n\t\treturn false, errors.New(\"invalid UTF-8 path\")\n\tdefault:\n\t\treturn false, errors.New(\"failed to read iCloud file resource status\")\n\t}\n}\n","sourceCodeStart":43,"sourceCodeEnd":64,"githubUrl":"https://github.com/siyuan-note/siyuan/blob/251596fc0de2f9528c00c224252fd073a99973f4/kernel/util/icloud_darwin.go#L43-L64","documentation":"Raised on macOS in isUbiquitousItem when the cgo helper returns -1, meaning [NSURL getResourceValue:forKey:NSURLIsUbiquitousItemKey error:] returned NO. This indicates Cocoa could not read the NSURLIsUbiquitousItemKey resource value for the path (the file may not exist, may be unreachable, or the resource key is unavailable). It is the default/other branch of the switch, distinct from the explicit -2 UTF-8 case.","triggerScenarios":"isICloudPath resolves the longest existing parent of the workspace and calls isUbiquitousItem on it; getResourceValue fails. Triggers: the parent path was deleted between stat and the Cocoa call, the process lacks sandbox entitlements to read NSURL resource values, or the volume does not support the resource key.","commonSituations":"Workspace on an external or network volume that momentarily disappears; a sandboxed build without the needed file-resource entitlement; a path under a fstab-mounted volume that hides extended attributes. The caller logs at debug level and falls back to a path-prefix iCloud match, so the user rarely sees this directly.","solutions":["Confirm the workspace parent path still exists and is readable by the kernel process.","Run SiYuan outside a restrictive sandbox, or grant the entitlement to read NSURL resource values.","No user action is required for correctness: iCloud detection falls back to the Library/Mobile Documents path-prefix check."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if isUbiquitous, err := isUbiquitousItem(existingPath); err != nil {\n    logging.LogDebugf(\"check iCloud status for path [%s] failed: %s\", existingPath, err)\n    // fall through to path-prefix iCloud detection\n} else if isUbiquitous {\n    return true\n}","preventionTips":["Run SiYuan with read access to NSURL resource values (avoid over-restrictive sandboxes).","Ensure the workspace parent path exists and is reachable before boot.","Rely on the path-prefix iCloud fallback; a -1 result is non-fatal."],"tags":["darwin","icloud","filesystem","macos-only","non-fatal"],"backgroundTag":null,"analyzedSha":"251596fc0de2f9528c00c224252fd073a99973f4","analyzedAt":"2026-08-12T21:18:37.123Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}