{"record":{"id":"9d1db6c5d5c896bf","repo":"xai-org/grok-build","slug":"e-error-daemon-error-message-propagated-via-anyho","errorCode":null,"errorMessage":"e.error (daemon error message propagated via anyhow!)","messagePattern":"e\\.error \\(daemon error message propagated via anyhow!\\)","errorType":"exception","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"crates/codegen/xai-fast-worktree/src/nfs/client.rs","lineNumber":230,"sourceCode":"            v: PROTOCOL_VERSION,\n            worktree_id: worktree_id.to_owned(),\n        };\n        match self.call(&req, self.ping_timeout.max(QUERY_PHASE_MIN_TIMEOUT)) {\n            Ok(Response::Ok(body)) => Ok(QuerySnapshot {\n                phase: body.create_phase,\n                declined: body.declined,\n                storage_full: body.storage_full,\n                unknown: false,\n                mount: body.mount,\n            }),\n            Ok(Response::Err(e)) if e.error.contains(\"unknown worktree_id\") => Ok(QuerySnapshot {\n                phase: None,\n                declined: None,\n                storage_full: false,\n                unknown: true,\n                mount: None,\n            }),\n            Ok(Response::Err(e)) => Err(NfsTryError::Other(anyhow!(e.error))),\n            Err(e) => Err(NfsTryError::Other(e)),\n        }\n    }\n\n    pub fn cancel_worktree_create(&self, worktree_id: &str) -> Result<(), anyhow::Error> {\n        if !self.ping() {\n            anyhow::bail!(\"grove daemon unreachable\");\n        }\n        let req = Request::CancelWorktreeCreate {\n            v: PROTOCOL_VERSION,\n            worktree_id: worktree_id.to_owned(),\n        };\n        match self.call(&req, REMOVE_RPC_TIMEOUT) {\n            Ok(Response::Ok(_)) => Ok(()),\n            Ok(Response::Err(e)) => Err(anyhow!(e.error)),\n            Err(e) => Err(e),\n        }\n    }","sourceCodeStart":212,"sourceCodeEnd":248,"githubUrl":"https://github.com/xai-org/grok-build/blob/bc7f02eddd3d84085849dc19ed216f11c23b0571/crates/codegen/xai-fast-worktree/src/nfs/client.rs#L212-L248","documentation":"Inside query_phase, when the daemon answers `Response::Err(e)`, the daemon's error string `e.error` is wrapped via `anyhow!` into an `NfsTryError::Other`. The resulting message is the daemon-side explanation (e.g. unknown worktree, declined, storage full), not a client-side message.","triggerScenarios":"Calling query_phase while the daemon rejects the request: worktree id unknown to the daemon, creation declined by policy, NFS storage full, or a mount error reported by the daemon.","commonSituations":"Polling after a lost reply for a create that never registered; daemon restarted losing in-memory worktree state; NFS export hitting capacity; version mismatch between client and daemon causing rejected requests.","solutions":["Read the propagated daemon message to identify the specific cause (unknown/declined/storage_full/mount)","Re-check the worktree_id used in the request matches one the daemon knows","Check daemon availability and restart state; retry creation if state was lost","Free NFS storage if the message indicates the export is full"],"exampleFix":"// handle daemon rejection explicitly\nmatch client.query_phase(&id) {\n    Ok(reply) => { /* use reply.phase */ }\n    Err(NfsTryError::Other(e)) => eprintln!(\"daemon rejected: {e}\"),\n    Err(e) => eprintln!(\"transport error: {e}\"),\n}","handlingStrategy":"type-guard","validationCode":"// Prefer structured reply over string matching:\nlet reply = client.query_phase(&id)?;\nif reply.unknown {\n    // daemon does not know this id — recreate before proceeding\n}\nif reply.storage_full {\n    // free space on the NFS export before retrying\n}","typeGuard":"fn daemon_rejection(err: &NfsTryError) -> Option<String> {\n    match err {\n        NfsTryError::Other(e) => Some(e.to_string()),\n        _ => None,\n    }\n}","tryCatchPattern":"match client.query_phase(&id) {\n    Ok(r) => handle(r),\n    Err(NfsTryError::Other(e)) => eprintln!(\"daemon error: {e}\"),\n    Err(e) => return Err(e.into()),\n}","preventionTips":["Check reply flags (unknown/declined/storage_full) instead of parsing error strings","Persist worktree ids so a lost reply can be re-queried safely","Monitor NFS export capacity before large creates","Keep client and daemon protocol versions in sync"],"tags":["daemon","rpc","nfs","worktree"],"backgroundTag":"daemon-rpc-error-response","analyzedSha":"bc7f02eddd3d84085849dc19ed216f11c23b0571","analyzedAt":"2026-08-31T04:59:42.031Z","schemaVersion":2},"datasetVersion":"2026-08-31T09:17:48.483Z"}