{"record":{"id":"594f1f37534af190","repo":"stalwartlabs/stalwart","slug":"not-found","errorCode":null,"errorMessage":"Not Found","messagePattern":"Not Found","errorType":"http","errorClass":"ScimError","httpStatus":404,"severity":"error","filePath":"crates/scim-proto/src/message/error.rs","lineNumber":171,"sourceCode":"\n    pub fn uniqueness(detail: impl Into<Cow<'static, str>>) -> Self {\n        Error {\n            status: 409,\n            scim_type: Some(ScimType::Uniqueness),\n            detail: Some(detail.into()),\n        }\n    }\n\n    pub fn unauthorized() -> Self {\n        Error::new(401)\n    }\n\n    pub fn forbidden(detail: impl Into<Cow<'static, str>>) -> Self {\n        Error::new(403).with_detail(detail)\n    }\n\n    pub fn not_found() -> Self {\n        Error::new(404)\n    }\n\n    pub fn conflict(detail: impl Into<Cow<'static, str>>) -> Self {\n        Error::new(409).with_detail(detail)\n    }\n\n    pub fn precondition_failed() -> Self {\n        Error::new(412)\n    }\n\n    pub fn max_operations_exceeded(max_operations: usize) -> Self {\n        Error::new(413).with_detail(format!(\n            \"The number of operations in the bulk request exceeds the maxOperations ({max_operations}).\"\n        ))\n    }\n\n    pub fn max_payload_size_exceeded(max_payload_size: usize) -> Self {\n        Error::new(413).with_detail(format!(","sourceCodeStart":153,"sourceCodeEnd":189,"githubUrl":"https://github.com/stalwartlabs/stalwart/blob/e96200385781a6a9995a8b839ac27d6c75a983ee/crates/scim-proto/src/message/error.rs#L153-L189","documentation":"This is a SCIM protocol Error carrying HTTP status 404 (\"Not Found\"), built by the `Error::not_found()` constructor in crates/scim-proto. The library throws it to signal that the addressed SCIM resource (a User, Group, or Enterprise extension endpoint) does not exist on the server. It contains no detail message, only the status code and default reason phrase.","triggerScenarios":"Calling any scim-proto error path that invokes `Error::not_found()`, i.e. handling GET/PUT/PATCH/DELETE on a resource ID that the server cannot resolve. In a server implementation this is returned when a lookup by ID yields no record.","commonSituations":"A client dereferences a stale user ID after the account was deleted; an ID is copied from a different tenant/environment; a typo or wrong-case ID is used in the URL path (e.g. /Users/abc123 with a wrong suffix).","solutions":["List or query the resource collection first (e.g. GET /Users?filter=userName eq \"...\") to obtain a valid, currently-existing ID.","Verify the resource was not deleted and that you are targeting the correct tenant/base URL.","Check the ID format and that it matches exactly what the server returned earlier (no truncation or case change)."],"exampleFix":"// before\nlet user = client.get_user(\"stale-id\").await?;\n// after\nif let Some(user) = client.find_user_by_username(\"jdoe@example.com\").await? {\n    // proceed with user.id\n}","handlingStrategy":"validation","validationCode":"// resolve the ID first and only use IDs returned by the server\nlet found = client.query_users(format!(\"userName eq \\\"{username}\\\"\")).await?;\nif found.resources.is_empty() { return Err(anyhow!(\"user does not exist\")); }\nlet id = found.resources[0].id.clone();","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always obtain resource IDs from a prior GET/QUERY on the same server and tenant.","Treat 404 as 'may have been deleted' and re-sync your local cache.","Never hard-code or persist resource IDs across environments."],"tags":["scim","http-404","rest"],"backgroundTag":"resource-not-found","analyzedSha":"e96200385781a6a9995a8b839ac27d6c75a983ee","analyzedAt":"2026-09-06T22:07:17.982Z","contentChangedAt":"2026-09-06T22:07:17.982Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}