{"record":{"id":"eae27b7c6faa0773","repo":"xai-org/x-algorithm","slug":"mm-local-snapshot-failed-to-read-path-e","errorCode":null,"errorMessage":"MM_LOCAL_SNAPSHOT: failed to read {path}: {e}","messagePattern":"MM_LOCAL_SNAPSHOT: failed to read (.+?): (.+?)","errorType":"error_code","errorClass":"anyhow::Error","httpStatus":null,"severity":"warning","filePath":"phoenix/crates/serving/xai-recsys-mm-server/src/mm_embedding_client.rs","lineNumber":296,"sourceCode":"\n    if !is_writer {\n        log::info!(\n            \"Worker {}: opened MM cache (read-only, {} shards)\",\n            worker_id,\n            NUM_SHARDS\n        );\n        return Ok((client, Box::pin(async { Ok(()) })));\n    }\n\n    if let Ok(path) = env::var(\"MM_LOCAL_SNAPSHOT\")\n        && !path.trim().is_empty()\n    {\n        log::warn!(\n            \"MM_LOCAL_SNAPSHOT set ({path}): loading MM embeddings from a LOCAL parquet \\\n             and SKIPPING O2 (offline/dev path, NOT production behavior).\"\n        );\n        let data = std::fs::read(&path)\n            .map_err(|e| anyhow::anyhow!(\"MM_LOCAL_SNAPSHOT: failed to read {path}: {e}\"))?;\n        let records = read_embeddings_from_parquet(bytes::Bytes::from(data), &path)?;\n        let n = records.len();\n        let client_for_load = client.clone();\n        let load_future = async move {\n            client_for_load.preload_embeddings(records, true).await;\n            log::warn!(\"MM_LOCAL_SNAPSHOT: loaded {n} MM embeddings into the cache (NOT O2).\");\n            Ok(())\n        };\n        return Ok((client, Box::pin(load_future)));\n    }\n\n    let mm_client_for_bg = client.clone();\n    let (o2_bucket, o2_prefix) = o2_env_vars();\n\n    match MmEmbeddingFetcher::from_env(&o2_bucket, &o2_prefix) {\n        Ok(o2_client) => {\n            log::info!(\"Successfully created O2 client, fetching embeddings for last 2 days...\");\n            let o2_future = async move {","sourceCodeStart":278,"sourceCodeEnd":314,"githubUrl":"https://github.com/xai-org/x-algorithm/blob/24c60942c5c5fdad3a6addffb4c6e6d2f228f04f/phoenix/crates/serving/xai-recsys-mm-server/src/mm_embedding_client.rs#L278-L314","documentation":"Raised in get_mm_client when the MM_LOCAL_SNAPSHOT env var is set but the referenced parquet file cannot be read. This is explicitly an offline/dev path (the log warns it skips O2), so the failure means the local snapshot file path is wrong or unreadable.","triggerScenarios":"Setting MM_LOCAL_SNAPSHOT to a nonexistent path, a path without read permissions, a directory, or a remote/uncached path; the file being locked or deleted mid-run.","commonSituations":"Dev machines pointing at a stale snapshot path; container deployments where the snapshot wasn't mounted; typos or ~ that isn't expanded; NFS/latency causing read failures.","solutions":["Verify the path exists and is readable: ls -l $MM_LOCAL_SNAPSHOT","Use an absolute path (no ~ or relative paths) in the env var","In containers, ensure the snapshot file is mounted/copied into the image or volume","Unset MM_LOCAL_SNAPSHOT in environments where the real O2 path should be used"],"exampleFix":"# before\nexport MM_LOCAL_SNAPSHOT=~/snapshots/mm.parquet\n\n# after\nexport MM_LOCAL_SNAPSHOT=/home/user/snapshots/mm.parquet\nls -l $MM_LOCAL_SNAPSHOT  # verify before launching","handlingStrategy":"validation","validationCode":"if let Ok(p) = std::env::var(\"MM_LOCAL_SNAPSHOT\") { assert!(std::fs::metadata(&p).map(|m| m.is_file()).unwrap_or(false), \"snapshot not readable: {p}\"); }","typeGuard":null,"tryCatchPattern":"null","preventionTips":["Use absolute paths in env vars","Never set MM_LOCAL_SNAPSHOT in production","Verify file presence in container startup hooks"],"tags":["env-var","local-file","dev-only","parquet","rust"],"backgroundTag":"env-file-path-invalid","analyzedSha":"24c60942c5c5fdad3a6addffb4c6e6d2f228f04f","analyzedAt":"2026-08-28T11:40:14.686Z","schemaVersion":2},"datasetVersion":"2026-08-28T16:17:29.566Z"}