{"record":{"id":"b9ad8fce11e7c145","repo":"stanfordnlp/CoreNLP","slug":"unhandled-input-format-for-scenegraph-inputform","errorCode":null,"errorMessage":"Unhandled input format for scenegraph: ${inputFormat}","messagePattern":"Unhandled input format for scenegraph: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/pipeline/StanfordCoreNLPServer.java","lineNumber":385,"sourceCode":"        return defaultEncoding;\n      }\n    } else {\n      return defaultEncoding;\n    }\n  }\n\n  /**\n   * Get a SceneGraph request from the query, either from a query parameter (q)\n   * or from the body of the request\n   * <br>\n   * TODO: don't actually know if the scenegraph parser is threadsafe.\n   *\n   * @return query\n   */\n  private String getSceneGraphRequest(Properties props, HttpExchange httpExchange) throws IOException, ClassNotFoundException {\n    final String inputFormat = props.getProperty(\"inputFormat\", \"text\");\n    if (!inputFormat.equals(\"text\")) {\n      throw new IOException(\"Unhandled input format for scenegraph: \" + inputFormat);\n    }\n    String query = props.getProperty(\"q\", null);\n    if (query != null) {\n      return query;\n    }\n\n    Headers headers = httpExchange.getRequestHeaders();\n    // the original default behavior of the server was to\n    // unescape, so let's assume by default that the input text is\n    // escaped.  if the Content-type is set to text we will know\n    // we shouldn't unescape after all\n    final String contentType = getContentType(headers);\n    // Get the encoding\n    final String encoding = getEncoding(headers);\n\n    String text = IOUtils.slurpReader(IOUtils.encodedInputStreamReader(httpExchange.getRequestBody(), encoding));\n    if (contentType.equals(URL_ENCODED)) {\n      try {","sourceCodeStart":367,"sourceCodeEnd":403,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/pipeline/StanfordCoreNLPServer.java#L367-L403","documentation":"The scenegraph endpoint only supports plain text input. getSceneGraphRequest() throws IOException immediately if the inputFormat property is anything other than 'text', because scene-graph parsing has no other input decoders.","triggerScenarios":"Calling the /scenegraph endpoint with properties containing inputFormat set to 'serialized', 'json', or any non-text value.","commonSituations":"Reusing the same properties block across endpoints (general pipeline requests allow serialized input, scenegraph does not); programmatic clients that always set inputFormat.","solutions":["Request /scenegraph with inputFormat=text (or omit it, text is the default)","Remove inputFormat from the properties passed to the scenegraph endpoint","Pass the query via the 'q' property or the request body as plain text"],"exampleFix":"// before\nprops.setProperty(\"inputFormat\", \"serialized\"); // scenegraph call\n// after\nprops.remove(\"inputFormat\"); // defaults to text for scenegraph","handlingStrategy":"validation","validationCode":"if (\"scenegraph\".equals(endpoint)) {\n  String in = props.getProperty(\"inputFormat\", \"text\");\n  if (!in.equals(\"text\")) props.remove(\"inputFormat\");\n}","typeGuard":null,"tryCatchPattern":"try {\n  queryScenegraph(props, q);\n} catch (IOException e) {\n  if (e.getMessage().startsWith(\"Unhandled input format for scenegraph\")) {\n    props.remove(\"inputFormat\");\n    queryScenegraph(props, q);\n  } else throw e;\n}","preventionTips":["Use per-endpoint properties blocks instead of sharing one global Properties","Omit inputFormat for scenegraph requests (text is default)"],"tags":["http-server","scenegraph","input-format"],"backgroundTag":"invalid-enum-value","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}