{"record":{"id":"a63245a37a0324e3","repo":"neondatabase/neon","slug":"invalid-protocol-scheme-scheme","errorCode":null,"errorMessage":"invalid protocol scheme: {scheme}","messagePattern":"invalid protocol scheme: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"libs/compute_api/src/spec.rs","lineNumber":653,"sourceCode":"    Libpq,\n    /// A newer, gRPC-based protocol. Uses grpc:// scheme.\n    #[serde(rename = \"grpc\")]\n    Grpc,\n}\n\nimpl PageserverProtocol {\n    /// Parses the protocol from a connstring scheme. Defaults to Libpq if no scheme is given.\n    /// Errors if the connstring is an invalid URL.\n    pub fn from_connstring(connstring: &str) -> anyhow::Result<Self> {\n        let scheme = match Url::parse(connstring) {\n            Ok(url) => url.scheme().to_lowercase(),\n            Err(url::ParseError::RelativeUrlWithoutBase) => return Ok(Self::default()),\n            Err(err) => return Err(anyhow!(\"invalid connstring URL: {err}\")),\n        };\n        match scheme.as_str() {\n            \"postgresql\" | \"postgres\" => Ok(Self::Libpq),\n            \"grpc\" => Ok(Self::Grpc),\n            scheme => Err(anyhow!(\"invalid protocol scheme: {scheme}\")),\n        }\n    }\n\n    /// Returns the URL scheme for the protocol, for use in connstrings.\n    pub fn scheme(&self) -> &'static str {\n        match self {\n            Self::Libpq => \"postgresql\",\n            Self::Grpc => \"grpc\",\n        }\n    }\n}\n\nimpl Display for PageserverProtocol {\n    fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {\n        f.write_str(self.scheme())\n    }\n}\n","sourceCodeStart":635,"sourceCodeEnd":671,"githubUrl":"https://github.com/neondatabase/neon/blob/8f60b04da47ffefe0e52bda2440134b42874eb75/libs/compute_api/src/spec.rs#L635-L671","documentation":"Thrown by PageserverProtocol::from_connstring() in neon's compute_api when the connstring parsed successfully as a URL but its scheme is neither postgresql/postgres (Libpq) nor grpc (Grpc). The scheme comparison is done on the lowercased scheme, so only these three spellings are accepted; everything else is rejected as an unsupported protocol.","triggerScenarios":"from_connstring(\"http://pageserver:6400\") or from_connstring(\"ws://host\") — any URL with a scheme other than postgres, postgresql, or grpc, e.g. an accidentally supplied management-HTTP URL where a data-plane connstring was expected.","commonSituations":"Pasting the pageserver's HTTP management endpoint (http://...:9898) into a field that expects the postgres or grpc data-plane connstring; a wrapper tool that prefixes ws:// or tcp:// to every address; typos like postgress:// or grcp://.","solutions":["Check the scheme of the connstring and change it to postgresql://, postgres://, or grpc:// as appropriate","Make sure you passed the data-plane connstring, not the pageserver HTTP management URL","Fix typos in the scheme (it must be exactly postgres, postgresql, or grpc, case-insensitive)","If the string has no scheme at all, that is fine — from_connstring defaults to Libpq; only wrong schemes fail"],"exampleFix":"# before\nPAGESERVER_CONNSTRING=\"http://pageserver-0:9898\"   # invalid protocol scheme: http\n\n# after\nPAGESERVER_CONNSTRING=\"postgres://pageserver-0:6400\" # or grpc://pageserver-0:50051","handlingStrategy":"validation","validationCode":"// Accept only the three supported schemes before use:\nfn scheme_supported(s: &str) -> bool {\n    url::Url::parse(s).ok()\n        .map(|u| matches!(u.scheme().to_lowercase().as_str(), \"postgres\" | \"postgresql\" | \"grpc\"))\n        .unwrap_or(true) // scheme-less defaults to Libpq\n}","typeGuard":null,"tryCatchPattern":"// Distinguish scheme errors from malformed-URL errors for clearer operator messages:\nmatch PageserverProtocol::from_connstring(s) {\n    Ok(p) => Ok(p),\n    Err(e) if e.to_string().contains(\"invalid protocol scheme\") => {\n        Err(anyhow!(\"{s}: use postgresql:// or grpc://; HTTP management URLs are not valid here\"))\n    }\n    Err(e) => Err(e),\n}","preventionTips":["Document each config field with the exact scheme it expects","Reject management/HTTP URLs at config validation for data-plane connstring fields","Watch for tooling that prefixes tcp:// or ws:// to all addresses"],"tags":["neon","pageserver","url-scheme","connection-string","compute-api"],"backgroundTag":"unsupported-url-scheme","analyzedSha":"8f60b04da47ffefe0e52bda2440134b42874eb75","analyzedAt":"2026-08-16T23:39:28.135Z","schemaVersion":2},"datasetVersion":"2026-08-17T04:17:16.089Z"}