toeverything/AFFiNE · error · io::Error

NotFound

NotFound

Error message

workspace cache directory not registered

What it means

MobileBlobCache.read_binary_file resolves the workspace's registered cache directory by universal_id; when no directory has been registered for that workspace, the lookup returns None and an io::Error (NotFound, this message) is raised instead of reading the file.

Solutions

  1. Register the workspace cache directory before resolving tokens.
  2. Open the workspace first, then retry.
Defensive patterns

Strategy: validation

When it happens

Trigger: Raised when read_binary_file is called for a universal_id that has no registered workspace cache directory in workspace_dirs.

Common situations: The workspace was not registered with the mobile blob cache before reading, e.g. after an app restart. Re-open the workspace so its cache directory is registered.

Understand the failure class

Background: "Not Found" / HTTP 404 Errors: What They Mean and How to Fix Them Across Libraries — this error's family across 6 libraries.


AI-assisted analysis of toeverything/AFFiNE@b4c8548c09 (2026-08-18). Data as JSON: /api/errors/7c3029c7a1ba1291. Report an issue: GitHub.

Appendix: source

Thrown at packages/frontend/mobile-native/src/cache/mod.rs:299

}

impl MobileBlobCache {
  pub(crate) fn read_binary_file(&self, universal_id: &str, value: &str) -> std::io::Result<Vec<u8>> {
    let path = value
      .strip_prefix(MOBILE_BLOB_FILE_PREFIX)
      .ok_or_else(|| std::io::Error::new(std::io::ErrorKind::InvalidInput, "invalid mobile file token"))?;

    let path = path.strip_prefix("file://").unwrap_or(path);
    let canonical = std::fs::canonicalize(path)?;
    let workspace_dir = {
      self
        .workspace_dirs
        .read()
        .expect("workspace cache lock poisoned")
        .get(universal_id)
        .cloned()
    }
    .ok_or_else(|| std::io::Error::new(std::io::ErrorKind::NotFound, "workspace cache directory not registered"))?;
    let workspace_dir = std::fs::canonicalize(workspace_dir)?;

    if !is_valid_mobile_cache_path(&canonical, &workspace_dir) {
      return Err(std::io::Error::new(
        std::io::ErrorKind::PermissionDenied,
        "mobile file token points outside the workspace cache directory",
      ));
    }

    let metadata = std::fs::metadata(&canonical)?;
    if !metadata.is_file() {
      return Err(std::io::Error::new(
        std::io::ErrorKind::InvalidInput,
        "mobile file token does not resolve to a file",
      ));
    }
    if metadata.len() > MOBILE_BLOB_MAX_READ_BYTES {
      return Err(std::io::Error::new(

View on GitHub (pinned to b4c8548c09)