jackwener/OpenCLI · warning · EmptyResultError
settings.json is empty (or contains only defaults).
Error message
settings.json is empty (or contains only defaults).
What it means
Thrown as an EmptyResultError when settings.json parses successfully but contains no usable entries — the parsed object has zero keys. The command's contract is to display a table of settings rows, and an empty object yields nothing to show.
Source
Thrown at clis/trae-solo/settings.js:50
throw new EmptyResultError('trae-solo settings-read', `settings.json not found: ${TRAE_SETTINGS_JSON}`);
}
const raw = fs.readFileSync(TRAE_SETTINGS_JSON, 'utf-8');
// Strip JSONC: line comments + block comments + trailing commas.
const stripped = raw
.replace(/\/\*[\s\S]*?\*\//g, '')
.replace(/^\s*\/\/.*$/gm, '')
.replace(/([^:"])\/\/.*$/gm, '$1')
.replace(/,(\s*[}\]])/g, '$1');
let obj;
try { obj = JSON.parse(stripped); } catch (e) {
throw new CommandExecutionError(`Failed to parse settings.json: ${e.message}`, '');
}
const rows = [];
for (const [k, v] of Object.entries(obj)) {
rows.push({ Field: k, Value: typeof v === 'object' ? JSON.stringify(v) : String(v) });
}
if (!rows.length) {
throw new EmptyResultError('trae-solo settings-read', 'settings.json is empty (or contains only defaults).');
}
return rows;
},
});
View on GitHub (pinned to 49907e53dc)
Solutions
- Add the settings you want to configure to settings.json as valid key/value pairs.
- Confirm you are reading the intended settings file path (it may be a fresh default file).
- If you expected values, check that trae actually persists settings to this file and not another profile path.
Example fix
// before (settings.json)
{}
// after
{ "theme": "dark", "autoSave": true } Defensive patterns
Strategy: validation
Validate before calling
const fs = require('fs');
const raw = fs.readFileSync(settingsPath, 'utf-8');
const hasEntries = /[^\s{}/]/.test(raw.replace(/\/\*[\s\S]*?\*\//g, '').replace(/^\s*\/\/.*$/gm, '')); Type guard
function hasSettings(obj) {
return obj != null && typeof obj === 'object' && Object.keys(obj).length > 0;
} Try / catch
try {
const rows = await settingsRead();
} catch (e) {
if (e instanceof EmptyResultError && /settings\.json is empty/.test(e.message)) {
// proceed with defaults or populate the file
} else throw e;
} Prevention
- Check that settings.json has at least one key before invoking the reader.
- Don't comment out every setting — remove unused ones instead.
- Know that an empty file means defaults apply; treat this as informational.
When it happens
Trigger: Running trae-solo settings-read when settings.json is `{}`, `{ }` with only comments, or contains only comment lines that get stripped to an empty object.
Common situations: Fresh trae install where settings were never customized; user commented out every setting; a reset wiped the file to empty braces.
Related errors
- Failed to parse settings.json: ${e.message}
- No installed skills.
- No prices returned for train_no=${trainNo} ${fromStation.nam
- No 12306 stations match "${keyword}"
- 12306 ${endpoint} returned an unexpected payload shape
AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29).
Data as JSON: /api/errors/47963610af55ce2c.
Report an issue: GitHub.