{"record":{"id":"a86db64a38554536","repo":"pot-app/pot-desktop","slug":"create-cache-dir-failed-a86db6","errorCode":null,"errorMessage":"Create Cache Dir Failed","messagePattern":"Create Cache Dir Failed","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"error","filePath":"src-tauri/src/window.rs","lineNumber":343,"sourceCode":"        window.set_size(*size).unwrap();\n    }\n\n    #[cfg(not(target_os = \"macos\"))]\n    window.set_fullscreen(true).unwrap();\n\n    window.set_always_on_top(true).unwrap();\n    window\n}\n\npub fn ocr_recognize() {\n    #[cfg(target_os = \"macos\")]\n    {\n        let app_handle = APP.get().unwrap();\n        let mut app_cache_dir_path = cache_dir().expect(\"Get Cache Dir Failed\");\n        app_cache_dir_path.push(&app_handle.config().tauri.bundle.identifier);\n        if !app_cache_dir_path.exists() {\n            // 创建目录\n            fs::create_dir_all(&app_cache_dir_path).expect(\"Create Cache Dir Failed\");\n        }\n        app_cache_dir_path.push(\"pot_screenshot_cut.png\");\n\n        let path = app_cache_dir_path.to_string_lossy().replace(\"\\\\\\\\?\\\\\", \"\");\n        println!(\"Screenshot path: {}\", path);\n        if let Ok(_output) = std::process::Command::new(\"/usr/sbin/screencapture\")\n            .arg(\"-i\")\n            .arg(\"-r\")\n            .arg(path)\n            .output()\n        {\n            recognize_window();\n        }\n    }\n    #[cfg(not(target_os = \"macos\"))]\n    {\n        let window = screenshot_window();\n        let window_ = window.clone();","sourceCodeStart":325,"sourceCodeEnd":361,"githubUrl":"https://github.com/pot-app/pot-desktop/blob/594d32ede96acd106b0256deaa8bb440ffcdff40/src-tauri/src/window.rs#L325-L361","documentation":"In the macOS branch of ocr_recognize(), fs::create_dir_all on <cache_dir>/<bundle.identifier> returned Err and .expect('Create Cache Dir Failed') panicked, so the directory needed for the OCR screenshot cut could not be created — usually caused by permissions, a read-only volume, or a non-directory file at the target path.","triggerScenarios":"Thrown at src-tauri/src/window.rs:343 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check permissions and existence of the cache directory path on macOS","Remove any regular file occupying the target path","Match on the io::Error and return/report it instead of panicking","Fall back to a temporary directory when creation fails"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"594d32ede96acd106b0256deaa8bb440ffcdff40","analyzedAt":"2026-09-02T18:12:21.811Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-09T21:17:11.164Z"}