MuleSoft · DataWeave
Text plain writer is unable to write Array
Text plain writer is unable to write Array means the script has no output format, so DataWeave inferred plain text and cannot write the array the script returns. Declare an output format that supports arrays.
VerifiedLast verified
01Error text
Text plain writer is unable to write Array.02Likely causes
- No output format is set, so the plain-text writer was inferred.
- The script returns an Array, which the plain-text writer cannot write.
03How to fix it
- Add an explicit output directive to the script.
- Use a format that can hold an array. The docs' example is
output application/java --- payload splitBy ' '. - Run the script again.
iNotes
The docs show the same kind of mismatch for multipart output, with a message that ends but got Array, while writing MultiPart. and the fix output application/json --- dw::core::Objects::keySet(payload.parts).
04Official documentation
→Related errors
- Trying to output non-whitespace characters outside main element treeThis DataWeave error means the script's output was inferred as XML, but the value it returns is not a valid XML document. Declare the output format you really want, for example output text/plain.
- MULE:EXPRESSIONMULE:EXPRESSION means an error occurred while Mule evaluated a DataWeave expression. Find the expression named in the log, check the values it reads for nulls or wrong types, and add a default or a handler.
Test every fix in a non-production environment before you apply it to production. See how entries are verified.
More for MuleSoft work:Open MuleSoft jobsMuleSoft rates and salariesHire a senior MuleSoft developer