{"record":{"id":"8f34174c3fcc09dd","repo":"stanfordnlp/CoreNLP","slug":"haven-t-implemented-protocol-backend-protocol","errorCode":null,"errorMessage":"Haven't implemented protocol: ${backend.protocol}","messagePattern":"Haven't implemented protocol: (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/pipeline/StanfordCoreNLPClient.java","lineNumber":519,"sourceCode":"        }\n        // 1.2 Set some protocol-independent properties\n        connection.setDoOutput(true);\n        connection.setRequestProperty(\"Content-Type\", \"application/x-protobuf\");\n        connection.setRequestProperty(\"Content-Length\", Integer.toString(message.length));\n        connection.setRequestProperty(\"Accept-Charset\", \"utf-8\");\n        connection.setRequestProperty(\"User-Agent\", StanfordCoreNLPClient.class.getName());\n        if (timeoutMilliseconds > 0) {\n          connection.setConnectTimeout(timeoutMilliseconds);\n          connection.setReadTimeout(timeoutMilliseconds);\n        }\n        // 1.3 Set some protocol-dependent properties\n        switch (backend.protocol) {\n          case \"https\":\n          case \"http\":\n            ((HttpURLConnection) connection).setRequestMethod(\"POST\");\n            break;\n          default:\n            throw new IllegalStateException(\"Haven't implemented protocol: \" + backend.protocol);\n        }\n\n        // 2. Annotate\n        // 2.1. Fire off the request\n        connection.connect();\n        connection.getOutputStream().write(message);\n        connection.getOutputStream().flush();\n        // 2.2 Await a response\n        // -- It might be possible to send more than one message, but we are not going to do that.\n        Annotation response = serializer.read(connection.getInputStream()).first;\n        // 2.3. Copy response over to original annotation\n        for (Class key : response.keySet()) {\n          annotation.set(key, response.get(key));\n        }\n\n        //Succeeded!  Can break out of the loop now\n        return;\n      } catch (Throwable t) {","sourceCodeStart":501,"sourceCodeEnd":537,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/StanfordCoreNLPClient.java#L501-L537","documentation":"StanfordCoreNLPClient connects to a CoreNLP server via a URLConnection. doAnnotation only implements http/https protocols; any other scheme in the backend server URL reaches the default branch and throws IllegalStateException 'Haven't implemented protocol'.","triggerScenarios":"Constructing a StanfordCoreNLPClient (or CoreNLPHttpClient) whose server URL uses a scheme other than http/https, e.g. 'file:', 'ftp:', or a malformed URL where the parsed protocol is empty/unexpected.","commonSituations":"Typo in server URL ('htp://', missing scheme); pointing the client at a unix-socket/file path; config copied from another tool using a different scheme.","solutions":["Set the server URL to a proper http://host:port or https://host:endpoint address.","Fix URL typos so java.net.URL parses scheme as http/https.","Run the CoreNLP server locally (java -mx4g -cp '*' edu.stanford.nlp.pipeline.StanfordCoreNLPServer -port 9000) and point the client at http://localhost:9000.","If a non-HTTP transport is needed, extend doAnnotation to handle that protocol - it is not supported out of the box."],"exampleFix":"// before\nProperties props = new Properties();\nprops.setProperty(\"corenlp.server\", \"localhost:9000\"); // parsed protocol invalid\n// after\nprops.setProperty(\"corenlp.server\", \"http://localhost:9000\");","handlingStrategy":"validation","validationCode":"URI uri = URI.create(serverUrl);\nif (!\"http\".equals(uri.getScheme()) && !\"https\".equals(uri.getScheme())) {\n  throw new IllegalArgumentException(\"CoreNLP server URL must use http/https: \" + serverUrl);\n}","typeGuard":null,"tryCatchPattern":"try { client.annotate(annotation); } catch (IllegalStateException e) { if (e.getMessage().startsWith(\"Haven't implemented protocol\")) { log.error(\"Use http(s) server URL, got: {}\", e.getMessage()); } throw e; }","preventionTips":["Always include an explicit http:// or https:// scheme in the server property.","Sanity-check the URL with java.net.URI before constructing the client.","Use StanfordCoreNLPServer locally with http://localhost:9000 as the canonical setup."],"tags":["java","http","url","protocol","client-server"],"backgroundTag":"unsupported-operation","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}