{"record":{"id":"a16b79e64a742395","repo":"tinyhumansai/openhuman","slug":"api-base-url-must-be-an-absolute-http-s-url-with","errorCode":null,"errorMessage":"API base URL must be an absolute http(s) URL with host","messagePattern":"API base URL must be an absolute http\\(s\\) URL with host","errorType":"validation","errorClass":"anyhow::Error","httpStatus":null,"severity":"error","filePath":"src/api/rest.rs","lineNumber":415,"sourceCode":"#[derive(Clone)]\npub struct BackendOAuthClient {\n    client: Client,\n    base: Url,\n    sdk: TinyHumansClient,\n}\n\nimpl BackendOAuthClient {\n    /// Creates a new `BackendOAuthClient` with the given API base URL.\n    ///\n    /// Any path, query, or fragment in `api_base` is stripped so that\n    /// `Url::join` always resolves root-relative REST paths correctly.\n    /// This guards against callers who pass a full LLM completions URL\n    /// (e.g. `https://host/v1/chat/completions`) instead of just the origin:\n    /// without stripping, `join(\"teams/me/usage\")` would produce the wrong\n    /// path `/v1/chat/teams/me/usage` via RFC 3986 relative resolution.\n    pub fn new(api_base: &str) -> Result<Self> {\n        let mut base = Url::parse(api_base.trim()).context(\"Invalid API base URL\")?;\n        anyhow::ensure!(\n            matches!(base.scheme(), \"http\" | \"https\") && base.host_str().is_some(),\n            \"API base URL must be an absolute http(s) URL with host\"\n        );\n        base.set_path(\"\");\n        base.set_query(None);\n        base.set_fragment(None);\n        let client = build_backend_reqwest_client()?;\n        // The product identity also rides on the SDK's own default headers, not\n        // just the transport's, so it survives if the SDK is ever given a\n        // client this crate did not build. The SDK applies its own headers\n        // after these, so it cannot be clobbered by `x-sdk-client`.\n        let sdk = TinyHumansClient::new(base.as_str())\n            .with_http_client(client.clone())\n            .with_default_headers(crate::api::product::product_identity_headers());\n        Ok(Self { client, base, sdk })\n    }\n\n    /// Borrow the underlying `reqwest::Client` for callers that need to","sourceCodeStart":397,"sourceCodeEnd":433,"githubUrl":"https://github.com/tinyhumansai/openhuman/blob/749120085864ce16e0f273c7b86fac7740b39c5b/src/api/rest.rs#L397-L433","documentation":"The api_base supplied to BackendOAuthClient did not parse as an absolute http(s) URL with a host, so there is no valid origin to join backend-relative REST paths against; initialization fails immediately.","triggerScenarios":"Thrown at src/api/rest.rs:415 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Pass an absolute origin such as https://api.example.com","Include the scheme; a bare hostname is not sufficient","Check the backend URL environment variable for truncation"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"749120085864ce16e0f273c7b86fac7740b39c5b","analyzedAt":"2026-08-17T21:21:45.363Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}