louis-e/arnis · warning · Error
empty -- nothing to parse
Error message
empty -- nothing to parse
What it means
FormatSniffer._is_wkt attempts to parse the sniffed input as WKT. When the input data is the empty string, there is nothing to parse, so the function throws 'empty -- nothing to parse' rather than returning null like other parse failures. Callers must treat empty input as a distinct error case from 'not WKT'.
Source
Thrown at src/gui/js/bbox.js:118
// try JSON
var json = JSON.parse(this.data);
// try GeoJSON
var parsed_data = new L.geoJson(json)
} catch (err) {
return null;
}
this.parse_type = "geojson";
return parsed_data;
};
FormatSniffer.prototype._is_wkt = function () {
if (this.data === "") {
throw new Error("empty -- nothing to parse");
}
try {
var parsed_data = new Wkt.Wkt(this.data);
} catch (err) {
return null;
}
this.parse_type = "wkt";
return parsed_data;
};
FormatSniffer.prototype._sniffFormat = function () {
var parsed_data = null;
var fail = false;
try {
var next = true;View on GitHub (pinned to 34048924d9)
Solutions
- Guard before sniffing: check this.data === "" (or trim() === "") and return null / a 'no input' result instead of invoking _is_wkt.
- Wrap the sniffing call in try/catch and treat the 'empty -- nothing to parse' message as 'no data provided' rather than a parse failure.
- Fix the UI layer to disable sniffing/parse until the user supplies non-empty input.
Example fix
// before
var format = sniffer._is_wkt(); // throws on empty input
// after
if (!sniffer.data || sniffer.data.trim() === "") {
return null; // nothing to parse
}
var format = sniffer._is_wkt(); Defensive patterns
Strategy: validation
Validate before calling
if (typeof data !== 'string' || data.trim() === '') {
return null; // nothing to sniff
} Type guard
function isNonEmptyString(v) {
return typeof v === 'string' && v.trim().length > 0;
} Try / catch
try {
return sniffer._is_wkt();
} catch (err) {
if (err && err.message === 'empty -- nothing to parse') return null;
throw err;
} Prevention
- Trim input before sniffing so whitespace-only input is handled as empty
- Disable parse/submit controls until the user enters non-empty data
- Handle zero-byte files as a distinct 'no input' case before format detection
When it happens
Trigger: Calling _is_wkt (or the format-sniffing entry point that dispatches to it) on a FormatSniffer whose data property is "" — e.g. sniffing an empty file, an empty textarea, or an empty pasted string.
Common situations: User submits a bounding-box/GUI form without entering any data; a file input reads a zero-byte file; upstream code trimmed whitespace-only input down to "" before sniffing; automated tests passing empty fixtures.
AI-assisted analysis of louis-e/arnis@34048924d9 (2026-09-03).
Data as JSON: /api/errors/078a855da5e3593b.
Report an issue: GitHub.