{"record":{"id":"f4a1f63384ac8016","repo":"jackwener/OpenCLI","slug":"settings-json-not-found-ag-settings-json","errorCode":null,"errorMessage":"settings.json not found: ${AG_SETTINGS_JSON}","messagePattern":"settings\\.json not found: (.+?)","errorType":"exception","errorClass":"CommandExecutionError","httpStatus":null,"severity":"error","filePath":"clis/antigravity/storage.js","lineNumber":346,"sourceCode":"            Modified: new Date(r.mtime).toISOString().replace('T', ' ').slice(0, 19),\n        }));\n    },\n});\n\n// ====== Settings ======\ncli({\n    site: 'antigravity',\n    name: 'settings-read',\n    access: 'read',\n    description: 'Read Antigravity\\'s user settings.json (theme, proxy, agCockpit, tfa.system.autoAccept, etc.).',\n    domain: 'localhost',\n    strategy: Strategy.LOCAL,\n    browser: false,\n    args: [],\n    columns: STORAGE_COLUMNS,\n    func: async () => {\n        if (!fs.existsSync(AG_SETTINGS_JSON)) {\n            throw new CommandExecutionError(`settings.json not found: ${AG_SETTINGS_JSON}`, '');\n        }\n        const raw = fs.readFileSync(AG_SETTINGS_JSON, 'utf-8');\n        // VSCode allows JSONC (line + block comments + trailing commas).\n        // Strip comments and trailing commas before parsing.\n        const stripped = raw\n            .replace(/\\/\\*[\\s\\S]*?\\*\\//g, '')              // block comments\n            .replace(/^\\s*\\/\\/.*$/gm, '')                  // line comments (full line)\n            .replace(/([^:\"])\\/\\/.*$/gm, '$1')             // line comments (after code)\n            .replace(/,(\\s*[}\\]])/g, '$1');                // trailing commas\n        let obj;\n        try { obj = JSON.parse(stripped); } catch (e) {\n            throw new CommandExecutionError(`Failed to parse settings.json: ${e.message}`, '');\n        }\n        const rows = [];\n        for (const [k, v] of Object.entries(obj)) {\n            rows.push({ Field: k, Value: typeof v === 'object' ? JSON.stringify(v) : String(v) });\n        }\n        return rows;","sourceCodeStart":328,"sourceCodeEnd":364,"githubUrl":"https://github.com/jackwener/OpenCLI/blob/49907e53dc3ade5c223ff0c4c2c2785687cec4e6/clis/antigravity/storage.js#L328-L364","documentation":"Thrown by `antigravity settings-read` as a CommandExecutionError when the user settings file (~/Library/Application Support/Antigravity/User/settings.json) does not exist. The command reads and parses this JSONC file into key/value rows, so it requires the file to be present. Missing settings.json means the user has no custom user-level settings.","triggerScenarios":"Running `opencli antigravity settings-read` when fs.existsSync(AG_SETTINGS_JSON) is false.","commonSituations":"Fresh Antigravity install where the user never modified settings via UI (VSCode-family apps create settings.json on first write); profile directory deleted; running as a different user whose home lacks the Antigravity dir.","solutions":["Open Antigravity's Settings UI and change any setting so settings.json is created, then rerun","Create the file manually: mkdir -p ~/Library/Application\\ Support/Antigravity/User && echo '{}' > ~/Library/Application\\ Support/Antigravity/User/settings.json","Verify you are running the CLI as the same OS user that owns the Antigravity profile"],"exampleFix":"// before (file missing)\n$ opencli antigravity settings-read\n// CommandExecutionError: settings.json not found: ...\n\n// after\n$ mkdir -p \"$HOME/Library/Application Support/Antigravity/User\"\n$ echo '{}' > \"$HOME/Library/Application Support/Antigravity/User/settings.json\"\n$ opencli antigravity settings-read","handlingStrategy":"validation","validationCode":"import * as fs from 'node:fs';\nimport * as path from 'node:path';\nimport * as os from 'node:os';\nconst settings = path.join(os.homedir(), 'Library/Application Support/Antigravity/User/settings.json');\nif (!fs.existsSync(settings)) {\n  fs.mkdirSync(path.dirname(settings), { recursive: true });\n  fs.writeFileSync(settings, '{}\\n');\n}","typeGuard":null,"tryCatchPattern":"try {\n  await cli.run(['antigravity', 'settings-read']);\n} catch (e) {\n  if (String(e.message).startsWith('settings.json not found')) {\n    console.log('No user settings yet — using defaults.');\n  } else throw e;\n}","preventionTips":["Create settings.json (even `{}`) on machine provisioning","Confirm you run as the user whose home contains the Antigravity profile","Note VSCode-family apps only create settings.json after the first settings change"],"tags":["filesystem","missing-file","settings","antigravity"],"backgroundTag":"file-not-found","analyzedSha":"49907e53dc3ade5c223ff0c4c2c2785687cec4e6","analyzedAt":"2026-08-29T08:14:47.543Z","schemaVersion":2},"datasetVersion":"2026-08-29T12:17:43.993Z"}