stanfordnlp/CoreNLP · error · IOException
Unhandled input format for scenegraph
Error message
Unhandled input format for scenegraph: ${inputFormat} What it means
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.
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
Example fix
// before
props.setProperty("inputFormat", "serialized"); // scenegraph call
// after
props.remove("inputFormat"); // defaults to text for scenegraph Defensive patterns
Strategy: validation
Validate before calling
if ("scenegraph".equals(endpoint)) {
String in = props.getProperty("inputFormat", "text");
if (!in.equals("text")) props.remove("inputFormat");
} Try / catch
try {
queryScenegraph(props, q);
} catch (IOException e) {
if (e.getMessage().startsWith("Unhandled input format for scenegraph")) {
props.remove("inputFormat");
queryScenegraph(props, q);
} else throw e;
} Prevention
- Use per-endpoint properties blocks instead of sharing one global Properties
- Omit inputFormat for scenegraph requests (text is default)
When it happens
Trigger: Calling the /scenegraph endpoint with properties containing inputFormat set to 'serialized', 'json', or any non-text value.
Common situations: Reusing the same properties block across endpoints (general pipeline requests allow serialized input, scenegraph does not); programmatic clients that always set inputFormat.
Understand the failure class
Background: Invalid enum value errors: "Unknown type", "Invalid scope", "must be one of" — when a string is not on the library's allowed list — this error's family across 23 libraries.
Related errors
- Could not parse input format
- Could not start liveness server. This will probably result…
- Couldn't parse + json
- Line doesn't contain two tokens
- Method not implemented!
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/b9ad8fce11e7c145.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/pipeline/StanfordCoreNLPServer.java:385
return defaultEncoding;
}
} else {
return defaultEncoding;
}
}
/**
* Get a SceneGraph request from the query, either from a query parameter (q)
* or from the body of the request
* <br>
* TODO: don't actually know if the scenegraph parser is threadsafe.
*
* @return query
*/
private String getSceneGraphRequest(Properties props, HttpExchange httpExchange) throws IOException, ClassNotFoundException {
final String inputFormat = props.getProperty("inputFormat", "text");
if (!inputFormat.equals("text")) {
throw new IOException("Unhandled input format for scenegraph: " + inputFormat);
}
String query = props.getProperty("q", null);
if (query != null) {
return query;
}
Headers headers = httpExchange.getRequestHeaders();
// the original default behavior of the server was to
// unescape, so let's assume by default that the input text is
// escaped. if the Content-type is set to text we will know
// we shouldn't unescape after all
final String contentType = getContentType(headers);
// Get the encoding
final String encoding = getEncoding(headers);
String text = IOUtils.slurpReader(IOUtils.encodedInputStreamReader(httpExchange.getRequestBody(), encoding));
if (contentType.equals(URL_ENCODED)) {
try {View on GitHub (pinned to 1b7edd19c4)