koala73/worldmonitor · info
Inputs changed while reading. Select the file again to impor
Error message
Inputs changed while reading. Select the file again to import.
What it means
During asynchronous worksheet import, the form snapshots the current revision counter before awaiting the file text. After parsing, if the revision has changed — meaning the user edited any input while the file was being read — the stale import is discarded with this error so user edits are never silently overwritten.
Solutions
- Re-select the file and avoid changing any input until the 'Worksheet imported' status appears.
- Retry the import; the error is purely a staleness guard, not corruption — the file itself is fine.
- Pause editing (or apply changes first, then import last) when importing large worksheets.
- If this recurs with no edits, verify no background code mutates form inputs (bumping revision) during import.
Example fix
// before
const text = await selected.text();
const imported = importOperationalWorksheet(text);
if (current !== revision) throw new Error('Inputs changed while reading. Select the file again to import.');
populate(imported.input);
// after
const text = await selected.text();
if (current !== revision) { importStatus.textContent = 'Inputs changed during import; reselect the file.'; return; }
const imported = importOperationalWorksheet(text);
populate(imported.input); Defensive patterns
Strategy: try-catch
Try / catch
try {
await importWorksheet(file);
} catch (e) {
if (e.message.startsWith('Inputs changed')) {
setStatus('Your edits took priority — pick the file again to import it.');
}
} Prevention
- Don't edit inputs between selecting a file and seeing the import confirmation.
- Treat this error as a safe retry: re-select the file when idle.
- For large files, import during idle periods to shorten the read window.
When it happens
Trigger: User selects a file to import, then types into or changes any form input before the async read/parse completes; the file-read finishes and detects revision !== current, throwing this error instead of calling populate().
Common situations: Large or slow file reads (slow disk, big file) giving the user time to keep editing; user changes a field immediately after picking a file out of habit; concurrent recalculations bumping revision during read.
Understand the failure class
Background: "Invalid state transition" errors: "status must be X, actually Y", "already rejected/charging/uninstalled", "cannot ... while running" — what they mean when a library rejects your call — this error's family across 31 libraries.
Related errors
- Search modal is not initialised
- Worksheet JSON must be no larger than 64 KiB.
- COMPANY_MONITORING_ADMISSION_EVIDENCE_MISSING
- Sign in to view your brief.
- Authenticated account changed during push setup
AI-assisted analysis of koala73/worldmonitor@7d06c8633d (2026-09-15).
Data as JSON: /api/errors/82863fd70efb08b7.
Report an issue: GitHub.
Appendix: source
Thrown at src/components/OperationalExposureForm.ts:150
root.append(h('header', { className: 'operational-header' },
h('p', { className: 'operational-eyebrow' }, 'LOCAL WORKSHEET'),
h('h2', { className: 'cdp-card-title' }, 'Operational what-if'),
h('p', { className: 'cdp-section-description' }, 'Compare usable stock, daily demand and delivery timing. Edit the labeled example to test your assumptions.')));
root.addEventListener('input', event => {
if (event.target instanceof HTMLInputElement && event.target.type !== 'file') { event.target.setCustomValidity(''); basis = 'user'; update(); }
});
const file = input('Import worksheet JSON', 'file', actions);
file.accept = '.json,application/json';
file.addEventListener('change', async () => {
const selected = file.files?.[0];
if (!selected) return;
const current = revision;
const generation = ++importGeneration;
try {
if (selected.size > MAX_OPERATIONAL_JSON_BYTES) throw new Error('Worksheet JSON must be no larger than 64 KiB.');
const imported = importOperationalWorksheet(await selected.text());
if (signal?.aborted || generation !== importGeneration) return;
if (current !== revision) throw new Error('Inputs changed while reading. Select the file again to import.');
populate(imported.input); importStatus.textContent = 'Worksheet imported. Results recalculated from its inputs.';
} catch (cause) {
importStatus.textContent = `Import rejected; your inputs are unchanged. ${cause instanceof Error ? cause.message : 'Invalid JSON.'}`;
} finally { if (generation === importGeneration) file.value = ''; }
});
exportButton.addEventListener('click', () => {
if (!snapshot) return;
const url = URL.createObjectURL(new Blob([JSON.stringify(snapshot, null, 2)], { type: 'application/json' }));
h('a', { href: url, download: 'operational-worksheet.json' }).click();
setTimeout(() => URL.revokeObjectURL(url), 30_000);
});
actions.append(exportButton);
root.append(actions, importStatus,
h('details', { className: 'operational-method operational-input-help' }, h('summary', {}, 'How this worksheet works'),
h('p', {}, 'Actual operating data is optional. Inputs stay in browser memory until page reload; export JSON to keep them. Use one unit for all quantities. Changing the unit relabels all quantities; it does not convert them. Up to 90 days and 30 deliveries per list. Quantities and costs allow 0-1 million with up to 6 decimal places.')),
h('div', { className: 'operational-workspace' }, editor, h('div', { className: 'operational-results' }, error, result)));
populate(session.draft ?? operationalExample());
return root;View on GitHub (pinned to 7d06c8633d)