pentaho/pentaho-kettle · error · JsonInputException
JsonInputException(ke)
Error message
JsonInputException(ke)
What it means
JsonInputException wrapping a KettleException raised while JsonInput.parseNextInputToRowSet() hands the input stream to data.reader.parse(input). The JSON reader (e.g. FastJsonReader via Json parser) failed to parse or process the stream, so the step aborts the transform after logging the underlying error.
Solutions
- Open the source file/URL and validate it parses as JSON (e.g. with jq or a JSON linter); fix the malformed input.
- Check the step log line written by logInputError for the root cause (parse error offset, IO error) and fix accordingly.
- If the source is a URL, verify it returns 200 with content-type application/json and is reachable from the Pentaho server host.
- Verify the encoding setting in the step matches the file's actual charset.
- If transient I/O, re-run; otherwise fix permissions on the source file.
Example fix
// before: reading a file that is not valid JSON // after: pre-validate outside the transformation String raw = new String(Files.readAllBytes(Paths.get(path)), StandardCharsets.UTF_8); new JSONParser().parse(raw); // throws early with a clear position if invalid
Defensive patterns
Strategy: validation
Validate before calling
// validate JSON before running the transformation
byte[] raw = Files.readAllBytes(Paths.get(path));
if (raw.length == 0) throw new IllegalStateException("Empty JSON file: " + path);
new JSONParser().parse(new String(raw, StandardCharsets.UTF_8)); Try / catch
try { runTransformation(); }
catch (KettleException e) {
if (e.getCause() instanceof JsonInputException) { logParseFailure(e); moveToErrorFolder(file); }
else throw e;
} Prevention
- Lint source JSON files before ingestion (jq/JSON linter in a prior job step).
- Verify URL sources return application/json with a non-error status.
- Match the step's encoding setting to the actual file charset.
- Use a 'Get File Names' + filter step to skip empty or unreadable files.
When it happens
Trigger: getOneOutputRow -> parseNextInputToRowSet: data.reader.parse(input) throws KettleException. Concretely: malformed JSON in a file/URL, unreadable or closed stream, or a nested KettleException from readInput (e.g. parse context null).
Common situations: Pointing the step at a truncated or non-JSON file; a URL field returning an HTML error page instead of JSON; encoding mismatch (file not in expected JSON charset); source file removed or locked between file-listing and read.
Understand the failure class
Background: JSON parse error: "Unexpected token" / "not valid JSON" / "failed to parse" — what JSON parsers are really complaining about — this error's family across 45 libraries.
Related errors
- ChangeFileEncoding.Error.CreatingFile
- ChangeFileEncoding.Error.ParentFolderNotExist
- ChangeFileEncoding.Error.SourceFileNotAFile
- ChangeFileEncoding.Error.SourceFileNotExists
- ChangeFileEncoding.Error.TargetFileIsEmpty
AI-assisted analysis of pentaho/pentaho-kettle@f3058517a1 (2026-09-13).
Data as JSON: /api/errors/8e24dcac65e752e9.
Report an issue: GitHub.
Appendix: source
Thrown at plugins/json/core/src/main/java/org/pentaho/di/trans/steps/jsoninput/JsonInput.java:256
@Override
protected void fillFileAdditionalFields( JsonInputData data, FileObject file ) throws FileSystemException {
super.fillFileAdditionalFields( data, file );
data.filename = KettleVFS.getFilename( file );
data.filenr++;
if ( log.isDetailed() ) {
logDetailed( BaseMessages.getString( PKG, "JsonInput.Log.OpeningFile", file.toString() ) );
}
addFileToResultFilesname( file );
}
private void parseNextInputToRowSet( InputStream input ) throws KettleException {
try {
data.readerRowSet = data.reader.parse( input );
input.close();
} catch ( KettleException ke ) {
logInputError( ke );
throw new JsonInputException( ke );
} catch ( Exception e ) {
logInputError( e );
throw new JsonInputException( e );
}
}
private void logInputError( KettleException e ) {
logError( e.getLocalizedMessage(), e );
inputError( e.getLocalizedMessage() );
}
private void logInputError( Exception e ) {
String errMsg = ( !meta.isInFields() || meta.getIsAFile() )
? BaseMessages.getString( PKG, "JsonReader.Error.ParsingFile", data.filename )
: BaseMessages.getString( PKG, "JsonReader.Error.ParsingString", data.readrow[ data.indexSourceField ] );
logError( errMsg, e );
inputError( errMsg );
}View on GitHub (pinned to f3058517a1)