{"record":{"id":"494d168dbb83d346","repo":"influxdata/influxdb","slug":"request-url-error-0","errorCode":null,"errorMessage":"request URL error: {0}","messagePattern":"request URL error: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"influxdb3_client/src/lib.rs","lineNumber":28,"sourceCode":"    tls::Version,\n};\nuse secrecy::{ExposeSecret, Secret};\nuse serde::{Serialize, de::DeserializeOwned};\nuse std::error::Error as _;\nuse std::io::Write as _;\nuse std::{fmt::Display, num::NonZeroUsize, path::PathBuf, string::FromUtf8Error, time::Duration};\nuse url::Url;\n\nuse influxdb3_types::http::*;\npub use influxdb3_types::write::Precision;\n\n/// Primary error type for the [`Client`]\n#[derive(Debug, thiserror::Error)]\npub enum Error {\n    #[error(\"base URL error: {}\", reqwest_description(.0))]\n    BaseUrl(#[source] reqwest::Error),\n\n    #[error(\"request URL error: {0}\")]\n    RequestUrl(#[from] url::ParseError),\n\n    #[error(\"failed to read the API response bytes: {}\", reqwest_description(.0))]\n    Bytes(#[source] reqwest::Error),\n\n    #[error(\"failed to serialize the request body: {0}\")]\n    RequestSerialization(#[source] serde_json::Error),\n\n    #[error(\n        \"provided parameter ('{name}') could not be converted \\\n        to a statment parameter\"\n    )]\n    ConvertQueryParam {\n        name: String,\n        #[source]\n        source: iox_query_params::Error,\n    },\n","sourceCodeStart":10,"sourceCodeEnd":46,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_client/src/lib.rs#L10-L46","documentation":"Error::RequestUrl wraps a url::ParseError produced when the client builds the URL for a specific API request from the base URL plus a path/query. Unlike BaseUrl, the base was fine but a request-path fragment, query parameter, or encoding produced an invalid URL.","triggerScenarios":"Calling client APIs with query parameters or path segments that fail URL parsing when appended (e.g. invalid characters in a database name, unencodable query values); the conversion comes via `#[from] url::ParseError`.","commonSituations":"Passing raw, unencoded user input into request paths; empty strings or special characters (spaces, control chars) in resource names used to build request URLs.","solutions":["Percent-encode path/query components (e.g. urlencoding::encode or the url crate's API) before calling the client method.","Sanitize resource names (database/table names) to URL-safe characters.","Verify the base URL is valid; an invalid base can surface here depending on which parse step fails first."],"exampleFix":"// before\nclient.api_v3_query_database(&format!(\"{}\", raw_user_input)).await?;\n// after\nlet db = urlencoding::encode(&raw_user_input);\nclient.api_v3_query_database(&db).await?;","handlingStrategy":"validation","validationCode":"fn encode_path_segment(s: &str) -> String { urlencoding::encode(s).into_owned() }\n// use before building request paths: let db = encode_path_segment(&db_name);","typeGuard":"fn url_safe(s: &str) -> bool { url::Url::parse(&format!(\"http://x/{s}\")).is_ok() }","tryCatchPattern":"match client.api_v3_query_database(&db).await {\n    Err(Error::RequestUrl(pe)) => Err(anyhow!(\"bad request URL for db '{db}': {pe}\")),\n    other => other,\n}","preventionTips":["Percent-encode all user-derived path/query components.","Restrict resource names to URL-safe characters at ingress.","Escape query values with a URL library, never string concatenation."],"tags":["url","parsing","query","encoding"],"backgroundTag":"invalid-url-format","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"}