Skip to content

JSONL reader skips entire file when input contains blank lines #2424

Description

@VectorPeak

Describe the issue

JSONLinesFileReader.read_file() parses every line returned by text.splitlines() with json.loads(line). If a .jsonl file contains an accidental blank or whitespace-only line between valid records, json.loads("") raises JSONDecodeError.

That exception bubbles up to InputReader._iterate_files(), where the reader catches the file-level exception, logs a warning, and skips the entire file. As a result, valid records before and after the blank line are not loaded.

Steps to reproduce

Create a JSONL input file:

{"text":"a"}

{"text":"b"}

Load it through the JSONL input reader.

Expected behavior

The blank or whitespace-only line is ignored and the two valid JSONL records are loaded.

Actual behavior

The blank line raises JSONDecodeError, and the parent input reader skips the whole file.

Additional context

This is a small parser robustness issue. It does not change handling for malformed non-empty JSONL lines.

A proposed fix is available in #2423.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Fields

    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions