{"record":{"id":"b640f882b3735a88","repo":"github/copilot-sdk","slug":"uriruntimeconnection-url-must-be-a-non-empty-strin","errorCode":null,"errorMessage":"UriRuntimeConnection url must be a non-empty string","messagePattern":"UriRuntimeConnection url must be a non-empty string","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"java/sdk/src/main/java/com/github/copilot/rpc/UriRuntimeConnection.java","lineNumber":23,"sourceCode":"package com.github.copilot.rpc;\n\nimport com.github.copilot.CopilotExperimental;\n\n/**\n * Connects to an already-running runtime at the configured URL. Construct with\n * {@link RuntimeConnection#forUri(String)}.\n *\n * @since 1.0.0\n */\n@CopilotExperimental\npublic final class UriRuntimeConnection extends RuntimeConnection {\n\n    private final String url;\n    private String connectionToken;\n\n    UriRuntimeConnection(String url) {\n        if (url == null || url.isEmpty()) {\n            throw new IllegalArgumentException(\"UriRuntimeConnection url must be a non-empty string\");\n        }\n        this.url = url;\n    }\n\n    /**\n     * Returns the URL of the runtime to connect to.\n     *\n     * @return the URL; accepts {@code \"port\"}, {@code \"host:port\"}, or a full URL\n     */\n    public String getUrl() {\n        return url;\n    }\n\n    /**\n     * Returns the shared secret used to authenticate the connection.\n     *\n     * @return the token, or {@code null} if the runtime does not require one\n     */","sourceCodeStart":5,"sourceCodeEnd":41,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/java/sdk/src/main/java/com/github/copilot/rpc/UriRuntimeConnection.java#L5-L41","documentation":"UriRuntimeConnection's package-private constructor validates its url argument and throws IllegalArgumentException when it is null or the empty string. The library requires every runtime connection to carry a usable URL before any connection logic runs, so empty/unset URLs fail fast at construction time rather than producing confusing failures later during connect.","triggerScenarios":"Calling the UriRuntimeConnection constructor (directly or via a factory/builder) with url == null or url == \"\" — e.g. reading a runtime endpoint from an unset config property or environment variable and passing it straight through.","commonSituations":"Config file or env var for the runtime endpoint is missing or blank; a properties loader returns empty strings for absent keys; a migration or version change renamed the endpoint key so the old lookup now returns null/empty; a builder was used without calling the url setter.","solutions":["Set a valid, non-empty runtime URL before constructing UriRuntimeConnection","Check the config source (env var, properties file) that supplies the URL — it is likely missing, blank, or under a renamed key","Log/inspect the value passed to the constructor at the call site to confirm it is null vs empty","If the URL is legitimately optional, guard the construction site and skip/defer creating the connection"],"exampleFix":"// before\nUriRuntimeConnection conn = new UriRuntimeConnection(config.get(\"runtime.url\"));\n// after\nString url = config.get(\"runtime.url\");\nif (url == null || url.isEmpty()) {\n    throw new IllegalStateException(\"runtime.url is not configured\");\n}\nUriRuntimeConnection conn = new UriRuntimeConnection(url);","handlingStrategy":"validation","validationCode":"if (url == null || url.isEmpty()) {\n    throw new IllegalStateException(\"runtime.url must be configured before creating UriRuntimeConnection\");\n}\nUriRuntimeConnection conn = new UriRuntimeConnection(url);","typeGuard":"static boolean isValidUrl(String url) {\n    return url != null && !url.isEmpty();\n}","tryCatchPattern":"try {\n    UriRuntimeConnection conn = new UriRuntimeConnection(url);\n} catch (IllegalArgumentException e) {\n    // url was null/empty: log config key and fail with actionable message\n}","preventionTips":["Validate config values at load time, before constructing connections","Never pass config lookups straight into constructors; check for null/empty first","Rename-config migrations: verify all endpoint keys resolve to non-empty values","Add a startup assertion that all required endpoint properties are set"],"tags":["java","configuration","url","validation"],"backgroundTag":"empty-required-field","analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}