{"record":{"id":"eff39c9bfe0a7f25","repo":"github/copilot-sdk","slug":"invalid-cliurl-format-url","errorCode":null,"errorMessage":"Invalid cliUrl format: ${url}","messagePattern":"Invalid cliUrl format: (.+?)","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"nodejs/src/client.ts","lineNumber":770,"sourceCode":"     * Parse CLI URL into host and port\n     * Supports formats: \"host:port\", \"[ipv6]:port\", \"http://host:port\", \"https://host:port\", or just \"port\"\n     */\n    private parseCliUrl(url: string): { host: string; port: number } {\n        // Remove protocol if present\n        const cleanUrl = url.replace(/^https?:\\/\\//, \"\");\n\n        // Check if it's just a port number\n        if (/^\\d+$/.test(cleanUrl)) {\n            return { host: \"localhost\", port: parseInt(cleanUrl, 10) };\n        }\n\n        // Handle the canonical bracketed IPv6 host:port form without changing\n        // the existing parser behavior for other inputs.\n        const ipv6Match = cleanUrl.match(/^\\[([^\\]]+)\\]:(\\d+)$/);\n        if (ipv6Match) {\n            const host = ipv6Match[1];\n            if (!isIPv6(host)) {\n                throw new Error(`Invalid cliUrl format: ${url}`);\n            }\n\n            const port = parseInt(ipv6Match[2], 10);\n            if (isNaN(port) || port <= 0 || port > 65535) {\n                throw new Error(`Invalid port in cliUrl: ${url}`);\n            }\n            return { host, port };\n        }\n\n        // Parse host:port format\n        const parts = cleanUrl.split(\":\");\n        if (parts.length !== 2) {\n            throw new Error(\n                `Invalid cliUrl format: ${url}. Expected \"host:port\", \"[ipv6]:port\", \"http://host:port\", or \"port\"`\n            );\n        }\n\n        const host = parts[0] || \"localhost\";","sourceCodeStart":752,"sourceCodeEnd":788,"githubUrl":"https://github.com/github/copilot-sdk/blob/cd8cf15dc3f9e762615790aaed0a771a0f392755/nodejs/src/client.ts#L752-L788","documentation":"parseCliUrl rejected the cliUrl string: inside a bracketed [ ... ]:port form, the host segment did not pass the isIPv6 check. The parser accepts 'host:port', '[ipv6]:port', 'http(s)://host:port', or a bare port; anything else — here specifically a malformed bracketed IPv6 host — triggers this throw.","triggerScenarios":"Thrown at nodejs/src/client.ts:770 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Use a valid IPv6 literal in brackets, e.g. '[::1]:8080'","Drop the brackets if the host is a hostname or IPv4, e.g. 'localhost:8080'","Verify the URL was not truncated or mangled by shell/config interpolation before reaching the parser"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"cd8cf15dc3f9e762615790aaed0a771a0f392755","analyzedAt":"2026-09-09T18:32:31.973Z","contentChangedAt":"2026-09-09T18:32:31.973Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}