ruvnet/RuView · error · Error
Invalid settings file format
Error message
Invalid settings file format
What it means
SettingsPanel's import handler (ui/components/SettingsPanel.js) parses an uploaded file with JSON.parse, then requires a top-level `settings` property ({ ...defaults, ...data.settings }). A file that parses as JSON but lacks `settings` throws 'Invalid settings file format'; the catch block surfaces it via alert. Note that raw JSON syntax errors are caught by the same catch but show their own parse message.
Source
Thrown at ui/components/SettingsPanel.js:783
importSettings(event) {
const file = event.target.files[0];
if (!file) return;
const reader = new FileReader();
reader.onload = (e) => {
try {
const data = JSON.parse(e.target.result);
if (data.settings) {
this.settings = { ...this.getDefaultSettings(), ...data.settings };
this.updateUI();
this.saveSettings();
this.notifyCallback('onSettingsChange', { imported: true, settings: this.settings });
this.notifyCallback('onImport', data);
this.updateStatus('Settings imported successfully');
this.logger.info('Settings imported successfully');
} else {
throw new Error('Invalid settings file format');
}
} catch (error) {
this.updateStatus('Error importing settings');
this.logger.error('Error importing settings', { error: error.message });
alert('Error importing settings: ' + error.message);
}
};
reader.readAsText(file);
event.target.value = ''; // Reset file input
}
saveSettings() {
if (this.config.allowConfigPersistence) {
try {
localStorage.setItem(`pose-settings-${this.containerId}`, JSON.stringify(this.settings));
} catch (error) {
this.logger.warn('Failed to save settings to localStorage', { error: error.message });View on GitHub (pinned to 4685618388)
Solutions
- Re-export settings from a working SettingsPanel and import that file — it has the expected { settings: {...} } shape.
- Wrap your existing values: edit the JSON so the top level is { "settings": { ...your current keys... } }.
- Open the file and confirm JSON.parse succeeds and a top-level `settings` object exists before importing.
Example fix
// before — file contents: { "theme": "dark", "confidence": 0.6 }
// after — file contents: { "settings": { "theme": "dark", "confidence": 0.6 } } Defensive patterns
Strategy: validation
Validate before calling
const data = JSON.parse(text);
if (!data || typeof data !== 'object' || Array.isArray(data) || typeof data.settings !== 'object' || data.settings === null) {
throw new Error('Invalid settings file format: expected { "settings": { ... } }');
}
// safe to hand to SettingsPanel import / merge Type guard
function isSettingsExport(v) {
return typeof v === 'object' && v !== null && !Array.isArray(v)
&& typeof v.settings === 'object' && v.settings !== null;
} Try / catch
try {
importSettings(file);
} catch (error) {
// JSON.parse failures and shape failures land here; show the message via non-blocking UI
showToast(`Import failed: ${error.message}`);
} Prevention
- Only import files previously exported by the same SettingsPanel version.
- Keep exports as { settings: {...} } — never flatten the envelope.
- After hand edits, validate the shape with a JSON tool before importing.
When it happens
Trigger: Importing an exported config wrapped differently (e.g. { config: {...} }), a settings dump from another app/version, or a hand-edited file where the `settings` key was renamed or removed.
Common situations: Users importing settings exported by an older UI version with a different envelope; importing the wrong JSON file (calibration data, zone config); manual edits that flattened the settings object to the top level.
Related errors
- brain line ${index + 1}: ${error.message}
- Request failed
- Invalid stream options: ${validationResult.errors.join(', ')
- No active stream connection to reconnect
- Cannot get connection stats for reconnection
AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16).
Data as JSON: /api/errors/d19cb91a3c8c8619.
Report an issue: GitHub.