{"record":{"id":"d0535b58a830a904","repo":"prestodb/presto","slug":"runtimeexception-e-d0535b","errorCode":null,"errorMessage":"RuntimeException(e)","messagePattern":"RuntimeException\\(e\\)","errorType":"exception","errorClass":"RuntimeException","httpStatus":null,"severity":"error","filePath":"presto-prometheus/src/main/java/com/facebook/presto/plugin/prometheus/PrometheusClient.java","lineNumber":100,"sourceCode":"        requireNonNull(typeManager, \"typeManager is null\");\n\n        bearerTokenFile = config.getBearerTokenFile();\n        URI prometheusMetricsUri = getPrometheusMetricsURI(config.getPrometheusURI());\n        tableSupplier = Suppliers.memoizeWithExpiration(\n                () -> fetchMetrics(metricCodec, prometheusMetricsUri),\n                config.getCacheDuration().toMillis(),\n                MILLISECONDS);\n        varcharMapType = typeManager.getType(mapType(VARCHAR.getTypeSignature(), VARCHAR.getTypeSignature()));\n    }\n\n    private static URI getPrometheusMetricsURI(URI prometheusUri)\n    {\n        try {\n            // endpoint to retrieve metric names from Prometheus\n            return new URI(prometheusUri.getScheme(), prometheusUri.getAuthority(), prometheusUri.getPath() + METRICS_ENDPOINT, null, null);\n        }\n        catch (URISyntaxException e) {\n            throw new RuntimeException(e);\n        }\n    }\n\n    public Set<String> getTableNames(String schema)\n    {\n        requireNonNull(schema, \"schema is null\");\n        String status = \"\";\n        if (schema.equals(\"default\")) {\n            if (!tableSupplier.get().isEmpty()) {\n                Object tableSupplierStatus = tableSupplier.get().get(\"status\");\n                if (tableSupplierStatus instanceof String) {\n                    status = (String) tableSupplierStatus;\n                }\n            }\n\n            //TODO prometheus warnings (success|error|warning) could be handled separately\n            if (status.equals(\"success\")) {\n                List<String> tableNames = (List<String>) tableSupplier.get().get(\"data\");","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/prestodb/presto/blob/55bb57d202de3b926896fa966c2c4a44c779634e/presto-prometheus/src/main/java/com/facebook/presto/plugin/prometheus/PrometheusClient.java#L82-L118","documentation":"PrometheusClient.getPrometheusMetricsURI derives the metrics-list endpoint URI by recombining scheme, authority, and path of the configured Prometheus URI with the METRICS_ENDPOINT suffix. Because URI's multi-argument constructor validates its parts, a malformed configured prometheus URI (illegal characters, bad authority, etc.) throws URISyntaxException, which is wrapped in a bare RuntimeException.","triggerScenarios":"prometheusMetricsUri is called with a prometheus-uri config value that produces an invalid URI when the metrics endpoint path is appended — e.g. characters needing escaping, malformed authority, or an unexpected path shape.","commonSituations":"Config values with unescaped spaces or unicode, a prometheus-uri including a query/fragment that doesn't recombine cleanly, typos like 'http://prometheus:9090//api' with path issues, or an empty/unset URI built from partial parts.","solutions":["Check the prometheus-uri property in the catalog config for typos or illegal characters","Use a plain form like http://prometheus-host:9090 with no query string or fragment","URL-encode any special characters in host/path components","Look at the wrapped URISyntaxException cause in the stack trace for the exact offending index/character"],"exampleFix":"// before\nprometheus-uri=http://prometheus host:9090\n// after\nprometheus-uri=http://prometheus-host:9090","handlingStrategy":"validation","validationCode":"java\nString uri = catalogProps.getProperty(\"prometheus-uri\");\nnew URI(uri); // throws URISyntaxException at config load if malformed\nObjects.requireNonNull(uri, \"prometheus-uri is required\");","typeGuard":null,"tryCatchPattern":"java\ntry {\n    Set<String> tables = client.getTableNames(\"default\");\n} catch (RuntimeException e) {\n    if (e.getCause() instanceof URISyntaxException) {\n        log.error(\"Fix prometheus-uri config: \" + e.getCause().getMessage());\n    }\n    throw e;\n}","preventionTips":["Validate prometheus-uri with new URI(...) at catalog config load time","Use plain http(s)://host:port form without query strings or fragments","Escape any special characters in URI components","Test the configured URI with curl before starting Presto"],"tags":["prometheus","uri","configuration","connector"],"backgroundTag":"invalid-uri","analyzedSha":"55bb57d202de3b926896fa966c2c4a44c779634e","analyzedAt":"2026-09-04T12:50:26.162Z","contentChangedAt":"2026-09-04T12:50:26.162Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}