{"record":{"id":"96af20d5f7c502ac","repo":"denisidoro/navi","slug":"incorrect-hash","errorCode":null,"errorMessage":"Incorrect hash","messagePattern":"Incorrect hash","errorType":"validation","errorClass":"anyhow","httpStatus":null,"severity":"error","filePath":"src/deser/raycast.rs","lineNumber":47,"sourceCode":"\n    let icon = if icon_str.is_empty() {\n        None\n    } else {\n        Some(icon_str.into())\n    };\n\n    let item = Item {\n        tags,\n        comment,\n        icon,\n        snippet,\n        ..Default::default()\n    };\n\n    if item.hash() != hash {\n        dbg!(&item.hash());\n        dbg!(hash);\n        Err(anyhow!(\"Incorrect hash\"))\n    } else {\n        Ok(item)\n    }\n}\n","sourceCodeStart":29,"sourceCodeEnd":52,"githubUrl":"https://github.com/denisidoro/navi/blob/f7330b9ad5bd95b7d1a3c96d00e0a77deb589147/src/deser/raycast.rs#L29-L52","documentation":"Returned by `read` in src/deser/raycast.rs when deserializing an item (a Raycast-style snippet) whose recomputed content hash does not match the expected hash stored alongside it. This guards against corrupted or hand-edited serialized data: the payload changed since the hash was written, so the library refuses to return untrusted data.","triggerScenarios":"Calling the deserialization/read entry point on a file or record where `item.hash()` differs from the expected `hash` value — typically after the item's content was modified out-of-band or the storage format/version changed without re-hashing.","commonSituations":"Users manually editing snippet/config files managed by the tool; a version upgrade changing hashing of fields; truncated or corrupted files after a crash or sync conflict; copying data files between machines with different content encodings.","solutions":["Regenerate or re-export the data so the stored hash is recomputed over the current content","Restore the file from a backup made before it was modified","Recreate the item through the tool itself instead of editing the storage file directly","If a version upgrade changed the hash scheme, re-run any provided migration or delete the stale cache/data so it is rebuilt"],"exampleFix":"// before: hand-edited file fails hash check\n{\n  \"name\": \"my snippet\",\n  \"text\": \"edited content\",\n  \"hash\": \"hash_of_original_content\"\n}\n// after: rebuild the entry via the tool (or recompute)\n{\n  \"name\": \"my snippet\",\n  \"text\": \"edited content\",\n  \"hash\": \"hash_of_edited_content\"\n}","handlingStrategy":"validation","validationCode":"// compute the same hash over the raw content before calling read\nlet expected = hash_content(&raw_item);\nif expected != stored_hash {\n    eprintln!(\"stale/corrupted entry: rebuild or restore before reading\");\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hand-edit files managed by the tool; use its own edit commands","Rebuild/re-hash data after upgrading to a version that changed the hash scheme","Keep backups of data files; treat hash mismatch as corruption, not a bug"],"tags":["deserialization","integrity-check","hash-mismatch"],"backgroundTag":"content-hash-mismatch","analyzedSha":"f7330b9ad5bd95b7d1a3c96d00e0a77deb589147","analyzedAt":"2026-09-03T13:58:22.429Z","contentChangedAt":"2026-09-03T13:58:22.429Z","schemaVersion":2},"datasetVersion":"2026-09-10T17:17:09.494Z"}