Python/Node wrappers silently drop empty-string hybrid_chunk_size

Author: SomSamantrayCreated Aug 29, 2026Updated Sep 11, 2026

Problem

The JVM CLI rejects blank --hybrid-chunk-size values with a dedicated error and exit code 2 (PR #710). But both Python and Node wrappers forward hybrid_chunk_size on truthiness, so an empty-string value ("") is silently dropped and processing proceeds with the default 50. Whitespace-only values (" ") are truthy, ARE forwarded, and reach the rejection — so behavior differs by entry point for the empty-string shape: JVM = exit 2, Python/Node = silent default. The dedicated error is unreachable through the primary wrapper entry points for exactly the value it targets.

The empty-string drop matches the long-standing convention for all optional string options (including --hybrid-timeout), so the resolution is a cross-option policy decision, not a one-off guard change.

Suggested fix

Decide the wrapper empty-string policy across ALL optional string options, not just chunk-size:

  • Option A: change the generated wrapper guards from truthiness to null/undefined checks (Python: if hybrid_chunk_size is not None:; Node: if (options.hybridChunkSize !== undefined)), regenerating from the generator, so empty-string values reach the JVM rejection. Add wrapper unit tests for the empty-string case.
  • Option B: document the empty-string drop as the established optional-parameter convention; whitespace-only values already reach the rejection and cover the typo-protection goal.

Requires generator change + wrapper tests either way.

Evidence

  • convert_generated.py:149 -- if hybrid_chunk_size: (empty string is falsy; the flag never reaches the JVM)
  • convert-options.generated.ts:305 -- if (options.hybridChunkSize) { (same in Node)
  • CLIOptions.java:677-680 -- if (trimmed == null || trimmed.isEmpty()) { throw new IllegalArgumentException("Option --hybrid-chunk-size requires a positive integer."); }

Source

PR: https://github.com/opendataloader-project/opendataloader-pdf/pull/710

Metadata

  • Severity: P3
  • Confidence: 75
  • Reviewer(s): reliability, adversarial
  • Finding ID: python-opendataloader-pdf-src-opendataloader_pdf-convert_generated.py-149-python-and-node-wrappers-silently-mask-the-empty-string-blank-rejection

Source: opendataloader-project/opendataloader-pdf