{"record":{"id":"4a30d567d22cfe9a","repo":"pentaho/pentaho-kettle","slug":"webresult-error-unablecreateresult","errorCode":null,"errorMessage":"WebResult.Error.UnableCreateResult","messagePattern":"WebResult\\.Error\\.UnableCreateResult","errorType":"exception","errorClass":"KettleXMLException","httpStatus":null,"severity":"error","filePath":"core/src/main/java/org/pentaho/di/www/WebResult.java","lineNumber":100,"sourceCode":"    this.result = result;\n  }\n\n  public String getMessage() {\n    return message;\n  }\n\n  public void setMessage( String message ) {\n    this.message = message;\n  }\n\n  public static WebResult fromXMLString( String xml ) throws KettleXMLException {\n    try {\n      Document doc = XMLHandler.loadXMLString( xml );\n      Node node = XMLHandler.getSubNode( doc, XML_TAG );\n\n      return new WebResult( node );\n    } catch ( Exception e ) {\n      throw new KettleXMLException( BaseMessages.getString( PKG, \"WebResult.Error.UnableCreateResult\" ), e );\n    }\n  }\n\n  /**\n   * @return the id\n   */\n  public String getId() {\n    return id;\n  }\n\n  /**\n   * @param id\n   *          the id to set\n   */\n  public void setId( String id ) {\n    this.id = id;\n  }\n}","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/pentaho/pentaho-kettle/blob/f3058517a153da500bf4551f46d79b91bf8ec552/core/src/main/java/org/pentaho/di/www/WebResult.java#L82-L118","documentation":"WebResult.fromXMLString parses an XML string and builds a WebResult from it; any failure loading the XML, locating the XML_TAG root node, or constructing WebResult(node) is wrapped in KettleXMLException with the localized 'WebResult.Error.UnableCreateResult' message. It signals the response XML could not be converted into a WebResult.","triggerScenarios":"Passing malformed XML, an empty/non-XML string, or XML lacking the expected <webresult> root element (XML_TAG) to WebResult.fromXMLString.","commonSituations":"Parsing the response of a Pentaho Carte/HTTP web service when the server returned an HTML error page, an empty body, or a non-standard payload instead of the expected WebResult XML.","solutions":["Log/inspect the cause (e.getCause()) and the raw input string to see what was actually received.","Verify the HTTP response status/content-type before parsing — only parse bodies that are the expected WebResult XML.","Check that the XML contains the <webresult> root tag; if parsing server output, fix the server-side handler.","Handle non-XML error responses (auth pages, proxy errors) separately before calling fromXMLString."],"exampleFix":"// before\nWebResult result = WebResult.fromXMLString( responseBody );\n// after\nif ( responseBody != null && responseBody.contains( \"<webresult>\" ) ) {\n  WebResult result = WebResult.fromXMLString( responseBody );\n} else {\n  // handle unexpected/non-XML response\n}","handlingStrategy":"try-catch","validationCode":"if ( xml == null || !xml.trim().startsWith( \"<\" ) || !xml.contains( \"<webresult>\" ) ) {\n  throw new IllegalStateException( \"Not a WebResult XML payload\" );\n}","typeGuard":"boolean looksLikeWebResult( String xml ) {\n  return xml != null && xml.contains( \"<webresult\" );\n}","tryCatchPattern":"try {\n  WebResult r = WebResult.fromXMLString( xml );\n} catch ( KettleXMLException e ) {\n  log.error( \"Unable to create WebResult from payload: \" + xml, e.getCause() );\n}","preventionTips":["Check HTTP status and content-type before parsing bodies","Log the raw response on parse failure","Handle HTML error pages / empty bodies as separate cases"],"tags":["xml","parse-error","http-response","carte"],"backgroundTag":"unexpected-response-shape","analyzedSha":"f3058517a153da500bf4551f46d79b91bf8ec552","analyzedAt":"2026-09-13T14:04:16.340Z","contentChangedAt":"2026-09-13T14:04:16.340Z","schemaVersion":2},"datasetVersion":"2026-09-20T23:17:15.980Z"}