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

  1. Add the settings you want to configure to settings.json as valid key/value pairs.
  2. Confirm you are reading the intended settings file path (it may be a fresh default file).
  3. 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

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


AI-assisted analysis of jackwener/OpenCLI@49907e53dc (2026-08-29). Data as JSON: /api/errors/47963610af55ce2c. Report an issue: GitHub.