{"record":{"id":"e50b4947d11d6394","repo":"risingwavelabs/risingwave","slug":"notfound-error-0","errorCode":null,"errorMessage":"NotFound error: {0}","messagePattern":"NotFound error: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"src/object_store/src/object/mem.rs","lineNumber":36,"sourceCode":"use std::task::{Context, Poll};\nuse std::time::{SystemTime, UNIX_EPOCH};\n\nuse bytes::{BufMut, Bytes, BytesMut};\nuse fail::fail_point;\nuse futures::Stream;\nuse itertools::Itertools;\nuse risingwave_common::range::RangeBoundsExt;\nuse thiserror::Error;\nuse tokio::sync::Mutex;\n\nuse super::{\n    ObjectError, ObjectMetadata, ObjectRangeBounds, ObjectResult, ObjectStore, StreamingUploader,\n};\nuse crate::object::{ObjectDataStream, ObjectMetadataIter};\n\n#[derive(Error, Debug)]\npub enum Error {\n    #[error(\"NotFound error: {0}\")]\n    NotFound(String),\n    #[error(\"Other error: {0}\")]\n    Other(String),\n}\n\nimpl Error {\n    pub fn is_object_not_found_error(&self) -> bool {\n        matches!(self, Error::NotFound(_))\n    }\n}\n\nimpl Error {\n    fn not_found(msg: impl ToString) -> Self {\n        Error::NotFound(msg.to_string())\n    }\n\n    fn other(msg: impl ToString) -> Self {\n        Error::Other(msg.to_string())","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/object_store/src/object/mem.rs#L18-L54","documentation":"The in-memory object store (crate::object::mem) returns Error::NotFound when a requested object key does not exist in the store. Callers convert it to ObjectError via From, and Error::is_object_not_found_error() recognizes it.","triggerScenarios":"Reading, getting metadata, or deleting a key from MemObjectStore/MemStreamingUploader state that was never written or has been removed — typically in tests or madsim runs.","commonSituations":"Unit/integration tests that reference keys before writing them, race conditions where a key is deleted between list and read, madsim-simulated object store missing objects after simulated restarts.","solutions":["Verify the exact key string/path was written before being read (watch for typo or missing leading/trailing separators)","Check that another component did not delete or overwrite the object","In tests, seed the store with the object before the read assertion","If this should be tolerated, use is_object_not_found_error() to branch on it instead of failing"],"exampleFix":"// before\nlet data = mem_store.read(obj_id, None).await?;\n// after\nmatch mem_store.read(obj_id, None).await {\n    Ok(d) => d,\n    Err(e) if e.to_string().starts_with(\"NotFound error:\") => {\n        tracing::warn!(object_id = obj_id, \"object missing, treating as absent\");\n        return Ok(None);\n    }\n    Err(e) => return Err(e.into()),\n}","handlingStrategy":"validation","validationCode":"// Ensure the key exists before reading (mem store supports listing)\nlet exists = mem_store\n    .list(prefix)\n    .await?\n    .iter()\n    .any(|m| m.key == expected_key);\nif !exists {\n    // treat as absent instead of erroring\n}","typeGuard":"fn is_object_not_found(e: &crate::object::mem::Error) -> bool {\n    matches!(e, crate::object::mem::Error::NotFound(_))\n}","tryCatchPattern":"match mem_store.read(key, None).await {\n    Ok(data) => data,\n    Err(e) if matches!(e, crate::object::mem::Error::NotFound(_)) => {\n        tracing::warn!(key, \"object not found in mem store\");\n        Default::default()\n    }\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Write objects before reading them in tests; seed fixture data explicitly","Use consistent key-building helpers to avoid path typos","Check for concurrent deletes when sharing a mem store across tasks"],"tags":["rust","object-store","not-found","memory-store"],"backgroundTag":"resource-not-found","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}