{"record":{"id":"91f13efb61236a7b","repo":"influxdata/influxdb","slug":"base-url-error","errorCode":null,"errorMessage":"base URL error: {}","messagePattern":"base URL error: (.+?)","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"influxdb3_client/src/lib.rs","lineNumber":25,"sourceCode":"use reqwest::{\n    Body, Certificate, IntoUrl, Method, StatusCode,\n    header::{CONTENT_ENCODING, CONTENT_TYPE, HeaderMap, HeaderValue},\n    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]","sourceCodeStart":7,"sourceCodeEnd":43,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_client/src/lib.rs#L7-L43","documentation":"The influxdb3_client Client wraps reqwest URL-parsing failures of its configured base URL into Error::BaseUrl, displayed as 'base URL error: {}'. It occurs when the string given for the server endpoint cannot be parsed into a valid reqwest/url::Url.","triggerScenarios":"Constructing `Client::new(\"not-a-url\")` or a base URL with a bad scheme/characters; passing an empty or malformed endpoint from configuration; providing a URL reqwest rejects (e.g. missing scheme).","commonSituations":"Config files with 'localhost:8181' (missing http://), trailing typos in environment variables, templating bugs that leave placeholder text in the URL.","solutions":["Fix the base URL to include a valid scheme and host, e.g. http://localhost:8181.","Validate/parse the URL with the `url` crate before passing it to Client::new.","Check the environment variable or config value that supplies the endpoint for typos or interpolation issues."],"exampleFix":"// before\nlet client = Client::new(\"localhost:8181\")?;\n// after\nlet client = Client::new(\"http://localhost:8181\")?;","handlingStrategy":"validation","validationCode":"fn valid_base_url(s: &str) -> bool {\n    url::Url::parse(s).map(|u| u.has_host()).unwrap_or(false)\n}\n// call before Client::new: assert!(valid_base_url(&base));","typeGuard":"fn as_url(s: &str) -> Option<url::Url> { url::Url::parse(s).ok() }","tryCatchPattern":"match Client::new(base) {\n    Err(e) if matches!(e, Error::BaseUrl(_)) => Err(format!(\"invalid base URL '{base}'\")),\n    other => other,\n}","preventionTips":["Always include the scheme (http:// or https://) in endpoint config.","Parse endpoint env vars with the url crate at config load time.","Add a smoke check that constructs the client at startup."],"tags":["url","reqwest","client","configuration"],"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"}