siyuan-note/siyuan · warning

failed to read iCloud file resource status

Error message

failed to read iCloud file resource status

What it means

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.

Source

Thrown at kernel/util/icloud_darwin.go:61

import (
	"errors"
	"unsafe"
)

func isUbiquitousItem(path string) (bool, error) {
	cPath := C.CString(path)
	defer C.free(unsafe.Pointer(cPath))

	switch C.siyuanIsUbiquitousItem(cPath) {
	case 1:
		return true, nil
	case 0:
		return false, nil
	case -2:
		return false, errors.New("invalid UTF-8 path")
	default:
		return false, errors.New("failed to read iCloud file resource status")
	}
}

View on GitHub (pinned to 251596fc0d)

Solutions

  1. Confirm the workspace parent path still exists and is readable by the kernel process.
  2. Run SiYuan outside a restrictive sandbox, or grant the entitlement to read NSURL resource values.
  3. No user action is required for correctness: iCloud detection falls back to the Library/Mobile Documents path-prefix check.
Defensive patterns

Strategy: try-catch

Try / catch

if isUbiquitous, err := isUbiquitousItem(existingPath); err != nil {
    logging.LogDebugf("check iCloud status for path [%s] failed: %s", existingPath, err)
    // fall through to path-prefix iCloud detection
} else if isUbiquitous {
    return true
}

Prevention

When it happens

Trigger: 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.

Common situations: 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.

Related errors


AI-assisted analysis of siyuan-note/siyuan@251596fc0d (2026-08-12). Data as JSON: /api/errors/fde0818fd2db54d7. Report an issue: GitHub.