{"record":{"id":"6560e7c1253f4b5b","repo":"nathanmarz/storm","slug":"unable-to-parse-string","errorCode":null,"errorMessage":"unable to parse: ${string}","messagePattern":"unable to parse: (.+?)","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"storm-core/src/jvm/backtype/storm/utils/ShellProcess.java","lineNumber":86,"sourceCode":"\n    public void writeMessage(Object msg) throws IOException {\n        writeString(JSONValue.toJSONString(msg));\n    }\n\n    private void writeString(String str) throws IOException {\n        byte[] strBytes = str.getBytes(\"UTF-8\");\n        processIn.write(strBytes, 0, strBytes.length);\n        processIn.writeBytes(\"\\nend\\n\");\n        processIn.flush();\n    }\n\n    public JSONObject readMessage() throws IOException {\n        String string = readString();\n        JSONObject msg = (JSONObject)JSONValue.parse(string);\n        if (msg != null) {\n            return msg;\n        } else {\n            throw new IOException(\"unable to parse: \" + string);\n        }\n    }\n\n    public String getErrorsString() {\n        if(processErrorStream!=null) {\n            try {\n                return IOUtils.toString(processErrorStream);\n            } catch(IOException e) {\n                return \"(Unable to capture error stream)\";\n            }\n        } else {\n            return \"\";\n        }\n    }\n\n    public void drainErrorStream()\n    {\n        try {","sourceCodeStart":68,"sourceCodeEnd":104,"githubUrl":"https://github.com/nathanmarz/storm/blob/cdb116e942666973bc4eaa0df098d5bab82739e7/storm-core/src/jvm/backtype/storm/utils/ShellProcess.java#L68-L104","documentation":"Thrown by ShellProcess.readMessage when a line read from the launched shell subprocess (for a non-JVM language driver) cannot be parsed as JSON via JSONValue.parse. It indicates the child process emitted malformed or unexpected output instead of a valid JSON message, often due to a crashed or misbehaving multilang process writing diagnostic text to stdout.","triggerScenarios":"Thrown at storm-core/src/jvm/backtype/storm/utils/ShellProcess.java:86 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Inspect the offending string in the message; stray print/debug output from the shell component is the usual culprit.","Ensure the multilang process writes only JSON messages (or end-of-stream markers) to stdout and sends diagnostics to stderr.","Check that the shell component's serializer/protocol matches what Storm expects (JSON lines terminated with \"end\").","Verify the subprocess did not crash or exit mid-conversation; check ShellProcess subprocess exit status and stderr logs."],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"cdb116e942666973bc4eaa0df098d5bab82739e7","analyzedAt":"2026-09-12T14:30:00.714Z","contentChangedAt":"2026-09-12T14:30:00.714Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}