{"record":{"id":"f829814d6245516a","repo":"databendlabs/databend","slug":"e-f82981","errorCode":null,"errorMessage":"{e}","messagePattern":"\\{e\\}","errorType":"validation","errorClass":"InvalidInput","httpStatus":null,"severity":"error","filePath":"src/common/storage/src/operator.rs","lineNumber":765,"sourceCode":"            return Err(Error::new(\n                ErrorKind::InvalidInput,\n                \"s3.access-key-id and s3.secret-access-key must be configured together\",\n            ));\n        }\n\n        if has_session_token && !(has_access_key && has_secret_key) {\n            return Err(Error::new(\n                ErrorKind::InvalidInput,\n                \"s3.session-token requires s3.access-key-id and s3.secret-access-key\",\n            ));\n        }\n\n        Ok(())\n    }\n\n    fn build_operator(&self, location: &str) -> Result<(Operator, usize)> {\n        let url = url::Url::parse(location)\n            .map_err(|e| Error::new(ErrorKind::InvalidInput, e.to_string()))?;\n\n        let scheme = url.scheme();\n\n        // Handle file:// and memory:// URIs which don't have a host/bucket\n        let is_local_scheme = matches!(scheme, \"file\" | \"memory\" | \"\");\n        let (bucket, relative_path_pos) = if is_local_scheme {\n            // For file:// URIs, the path starts after \"file://\"\n            let prefix_len = if location.starts_with(\"file://\") {\n                7 // \"file://\".len()\n            } else if location.starts_with(\"memory://\") {\n                9 // \"memory://\".len()\n            } else {\n                0\n            };\n            (None, prefix_len)\n        } else {\n            let bucket = url\n                .host_str()","sourceCodeStart":747,"sourceCodeEnd":783,"githubUrl":"https://github.com/databendlabs/databend/blob/288d84d76e20a2f8f7173bda9691eb6ece301aa9/src/common/storage/src/operator.rs#L747-L783","documentation":"IcebergFileIO::build_operator parses the table location string with the url crate before deriving the bucket and path. If the location is not a valid URI, the parse error's Display text is wrapped in an InvalidInput error and returned verbatim. This guards every downstream scheme/bucket extraction which assumes a parsed URL.","triggerScenarios":"Calling get_operator_path (or the iceberg_file_io_* test paths) with a location string that fails url::Url::parse, e.g. 's3://', 'bucket/path' without a scheme, spaces or illegal characters in the URI, or a malformed authority.","commonSituations":"Catalog metadata holding a truncated or hand-edited table location; a path stored without its scheme prefix; whitespace/newline contamination from config files or environment variables; non-UTF8-safe or percent-encoding issues in object keys.","solutions":["Read the wrapped message (it is the url::ParseError text, e.g. 'relative URL without a base') and fix the location string accordingly.","Ensure the location includes scheme, host/bucket and path, e.g. 's3://my-bucket/warehouse/db/table'.","Trim whitespace and validate the location before passing it to the registry.","If the location comes from a catalog, re-register the table with a correct metadata location."],"exampleFix":"// before\nlet (op, pos) = file_io.get_operator_path(\"s3:/my-bucket/table\")?; // invalid: single slash, no host\n// after\nlet (op, pos) = file_io.get_operator_path(\"s3://my-bucket/table\")?;","handlingStrategy":"validation","validationCode":"fn valid_location(loc: &str) -> bool {\n    loc.trim() == loc && url::Url::parse(loc)\n        .map(|u| !u.scheme().is_empty())\n        .unwrap_or(false)\n}","typeGuard":null,"tryCatchPattern":"let location = location.trim();\nlet parsed = url::Url::parse(location)\n    .map_err(|e| anyhow!(\"invalid iceberg location {location:?}: {e}\"))?;","preventionTips":["Build table locations with a helper that always emits scheme://bucket/path form.","Trim whitespace/newlines from locations read from configs or env vars.","Validate catalog metadata locations at registration time."],"tags":["storage","iceberg","url","parsing"],"backgroundTag":"invalid-url-format","analyzedSha":"288d84d76e20a2f8f7173bda9691eb6ece301aa9","analyzedAt":"2026-09-11T11:29:36.208Z","contentChangedAt":"2026-09-11T11:29:36.208Z","schemaVersion":2},"datasetVersion":"2026-09-16T04:17:20.429Z"}