{"record":{"id":"7c3029c7a1ba1291","repo":"toeverything/AFFiNE","slug":"notfound","errorCode":"NotFound","errorMessage":"workspace cache directory not registered","messagePattern":"workspace cache directory not registered","errorType":"exception","errorClass":"io::Error","httpStatus":null,"severity":"error","filePath":"packages/frontend/mobile-native/src/cache/mod.rs","lineNumber":299,"sourceCode":"}\n\nimpl MobileBlobCache {\n  pub(crate) fn read_binary_file(&self, universal_id: &str, value: &str) -> std::io::Result<Vec<u8>> {\n    let path = value\n      .strip_prefix(MOBILE_BLOB_FILE_PREFIX)\n      .ok_or_else(|| std::io::Error::new(std::io::ErrorKind::InvalidInput, \"invalid mobile file token\"))?;\n\n    let path = path.strip_prefix(\"file://\").unwrap_or(path);\n    let canonical = std::fs::canonicalize(path)?;\n    let workspace_dir = {\n      self\n        .workspace_dirs\n        .read()\n        .expect(\"workspace cache lock poisoned\")\n        .get(universal_id)\n        .cloned()\n    }\n    .ok_or_else(|| std::io::Error::new(std::io::ErrorKind::NotFound, \"workspace cache directory not registered\"))?;\n    let workspace_dir = std::fs::canonicalize(workspace_dir)?;\n\n    if !is_valid_mobile_cache_path(&canonical, &workspace_dir) {\n      return Err(std::io::Error::new(\n        std::io::ErrorKind::PermissionDenied,\n        \"mobile file token points outside the workspace cache directory\",\n      ));\n    }\n\n    let metadata = std::fs::metadata(&canonical)?;\n    if !metadata.is_file() {\n      return Err(std::io::Error::new(\n        std::io::ErrorKind::InvalidInput,\n        \"mobile file token does not resolve to a file\",\n      ));\n    }\n    if metadata.len() > MOBILE_BLOB_MAX_READ_BYTES {\n      return Err(std::io::Error::new(","sourceCodeStart":281,"sourceCodeEnd":317,"githubUrl":"https://github.com/toeverything/AFFiNE/blob/b4c8548c09da21b2898443559a5b846f0ccf5dd8/packages/frontend/mobile-native/src/cache/mod.rs#L281-L317","documentation":"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.","triggerScenarios":"Raised when read_binary_file is called for a universal_id that has no registered workspace cache directory in workspace_dirs.","commonSituations":"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.","solutions":["Register the workspace cache directory before resolving tokens.","Open the workspace first, then retry."],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"b4c8548c09da21b2898443559a5b846f0ccf5dd8","analyzedAt":"2026-08-18T21:16:52.546Z","contentChangedAt":"2026-08-18T21:16:52.546Z","schemaVersion":2},"datasetVersion":"2026-09-14T00:17:10.932Z"}