koala73/worldmonitor · error · Error
Invalid format: expected an object with a data property.
Error message
Invalid format: expected an object with a data property.
What it means
UI error in importSettings: the settings file parsed as JSON but its shape is wrong — there is no usable object 'data' property (missing, non-object, or an array). A shape guard distinguishing valid exports from arbitrary JSON before version migration runs.
Source
Thrown at src/utils/settings-persistence.ts:88
URL.revokeObjectURL(url);
}
export function importSettings(file: File): Promise<ImportResult> {
return new Promise((resolve, reject) => {
if (file.size > MAX_IMPORT_SIZE_BYTES) {
reject(new Error('File is too large. Maximum size is 5MB.'));
return;
}
const reader = new FileReader();
reader.onload = (e) => {
try {
const result = e.target?.result as string;
const parsed = JSON.parse(result) as ExportedSettings;
if (!parsed || typeof parsed.data !== 'object' || Array.isArray(parsed.data)) {
throw new Error('Invalid format: expected an object with a data property.');
}
if (parsed.version !== 1) {
throw new Error(`Unsupported settings version: ${parsed.version}`);
}
let keysImported = 0;
const importedKeys: string[] = [];
for (const [key, value] of Object.entries(parsed.data)) {
if (isSettingsKey(key) && typeof value === 'string') {
localStorage.setItem(key, value);
keysImported++;
importedKeys.push(key);
}
}
invalidatePanelStorageCacheForKeys(importedKeys);
resolve({ success: true, keysImported });View on GitHub (pinned to a96956387a)
Solutions
- Use a file produced by the app's exportSettings function
- Verify the JSON has a top-level 'data' object plus 'version'
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at src/utils/settings-persistence.ts:85 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of koala73/worldmonitor@a96956387a (2026-08-21).
Data as JSON: /api/errors/734f0b5907f992ec.
Report an issue: GitHub.