{"record":{"id":"762495a83db83ac9","repo":"influxdata/influxdb","slug":"message","errorCode":null,"errorMessage":"{message}","messagePattern":"\\{message\\}","errorType":"exception","errorClass":"ServerError","httpStatus":null,"severity":"error","filePath":"core/influxdb_iox_client/src/client/error.rs","lineNumber":13,"sourceCode":"use generated_types::{\n    Code, Status,\n    google::{AlreadyExists, FieldViolation, NotFound, PreconditionViolation},\n};\nuse std::fmt::Debug;\nuse thiserror::Error;\n\n/// A generic opaque error\npub type StdError = Box<dyn std::error::Error + Send + Sync + 'static>;\n\n/// A gRPC error payload with optional [details](https://cloud.google.com/apis/design/errors#error_details)\n#[derive(Error, Debug, Clone)]\n#[error(\"{message}\")]\npub struct ServerError<D> {\n    /// A human readable error message\n    pub message: String,\n    /// An optional machine-readable error\n    pub details: Option<D>,\n}\n\nfn parse_status<D: ServerErrorDetails>(status: Status) -> ServerError<D> {\n    ServerError {\n        message: status.message().to_string(),\n        details: D::try_decode(&status),\n    }\n}\n\ntrait ServerErrorDetails: Sized {\n    fn try_decode(data: &Status) -> Option<Self>;\n}\n","sourceCodeStart":1,"sourceCodeEnd":31,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/core/influxdb_iox_client/src/client/error.rs#L1-L31","documentation":"`ServerError<D>` is the IOx client's generic opaque error payload for a gRPC response, whose Display is simply its `message` field. It wraps a human-readable message from the server plus an optional machine-readable `details` value, so any server-side failure surfaces through this struct verbatim.","triggerScenarios":"Any gRPC call made through the `influxdb_iox_client` client where the server returns an error status with a message — the client wraps the status message into `ServerError` (e.g. as `Error::Unknown(ServerError)` or a typed variant).","commonSituations":"Server-side failures such as invalid queries, namespace/database not found, resource exhaustion, or internal errors; version mismatches where the client hits an endpoint the server rejects; permission problems.","solutions":["Read the `message` field to see the server's explanation of the failure.","Inspect `details` (if present) for a machine-readable error type and handle it programmatically.","Match on the client `Error` enum variant to distinguish known statuses (Cancelled, InvalidArgument, etc.) from `Error::Unknown`.","Check server logs for the corresponding request to find the root cause."],"exampleFix":"// before\nclient.do_something(req).await?; // opaque ServerError surfaces\n// after\nmatch client.do_something(req).await {\n    Err(e) => {\n        if let Some(msg) = server_message(&e) { log::error!(\"server: {msg}\"); }\n        Err(e)\n    }\n    ok => ok,\n}","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"match client.call(req).await {\n    Err(err) => {\n        if let Some(msg) = err.server_message() {\n            log::error!(\"server error: {msg}\");\n        }\n        Err(err)\n    }\n    ok => ok,\n}","preventionTips":["Always inspect both `message` and `details` on ServerError","Map known gRPC statuses to application-specific handling","Log server errors with request context to correlate with server logs"],"tags":["rust","grpc","client","api-error"],"backgroundTag":"api-error-response","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}