{"record":{"id":"5eb2e6fba7af0eac","repo":"chatboxai/chatbox","slug":"unknown-or-protected-setting-key","errorCode":null,"errorMessage":"Unknown or protected setting: ${key}","messagePattern":"Unknown or protected setting: (.+?)","errorType":"validation","errorClass":"ChatboxCliUsageError","httpStatus":null,"severity":"warning","filePath":"src/renderer/packages/chatbox-cli/settings.ts","lineNumber":116,"sourceCode":"    read: () => settingsStore.getState().messageLayout ?? 'bubble',\n  },\n  {\n    key: 'chat.compaction-threshold',\n    description: 'Context compaction threshold.',\n    page: 'Chat Settings',\n    read: () => settingsStore.getState().compactionThreshold,\n  },\n  {\n    key: 'app.startup-page',\n    description: 'Page shown at startup.',\n    page: 'General Settings',\n    read: () => settingsStore.getState().startupPage ?? 'home',\n  },\n]\n\nfunction findSetting(key: string): SafeSettingSpec {\n  const setting = safeSettings.find((candidate) => candidate.key === key)\n  if (!setting) throw new ChatboxCliUsageError(`Unknown or protected setting: ${key}`)\n  return setting\n}\n\nexport const settingsCommands: ChatboxCliCommandDefinition[] = [\n  {\n    path: ['settings', 'list'],\n    description: 'List settings exposed through the read-only CLI allowlist.',\n    usage: 'chatbox settings list',\n    execute() {\n      return {\n        readOnly: true,\n        changeGuidance: 'Guide the user to the listed Chatbox Settings page to make changes manually.',\n        settings: safeSettings.map((setting) => ({\n          key: setting.key,\n          value: setting.read(),\n          description: setting.description,\n          location: `Settings > ${setting.page}`,\n        })),","sourceCodeStart":98,"sourceCodeEnd":134,"githubUrl":"https://github.com/chatboxai/chatbox/blob/81571269addb6bafb589a920b2883f1e1e084fd1/src/renderer/packages/chatbox-cli/settings.ts#L98-L134","documentation":"Thrown by findSetting() in the CLI settings module when the requested key does not match any entry in the safeSettings allowlist. The allowlist is an explicit, hand-curated set of read-only settings; anything not on it (including write-protected/internal keys) is refused to prevent the CLI from reading sensitive or unsupported state.","triggerScenarios":"Running `chatbox settings get <key>` where <key> is misspelled, uses the wrong dot-namespace, or refers to a setting that exists in the app but was deliberately excluded from safeSettings. The lookup is an exact-string match against candidate.key.","commonSituations":"Typo in the key (e.g. 'app.startUp-page' vs 'app.startup-page'); guessing a key name from the UI that the CLI never exposed; version drift where a setting was renamed or removed from the allowlist in a newer build.","solutions":["Run `chatbox settings list` to see every key the CLI actually exposes, then copy the exact key.","Check the dot-namespace and casing against the listed key precisely.","If the key is legitimately missing, it must be added to the safeSettings array in settings.ts before the CLI can read it — this is intentional, not a bug."],"exampleFix":"// before\nchatbox settings get app.startUp-page\n\n// after\nchatbox settings get app.startup-page","handlingStrategy":"validation","validationCode":"const KNOWN_KEYS = safeSettings.map(s => s.key)\nif (!KNOWN_KEYS.includes(requestedKey)) {\n  // show `chatbox settings list` instead of calling get\n}","typeGuard":"function isKnownSettingKey(key: string): boolean {\n  return safeSettings.some(s => s.key === key)\n}","tryCatchPattern":"try {\n  await runSettingsGet(key)\n} catch (e) {\n  if (e instanceof ChatboxCliUsageError && /Unknown or protected/.test(e.message)) {\n    // offer `settings list` to the user\n  }\n  throw e\n}","preventionTips":["Always offer a `settings list` lookup before `settings get` in UX.","Treat the allowlist as the source of truth — never guess key names.","Re-sync key names after app upgrades."],"tags":["cli","validation","settings","allowlist"],"backgroundTag":null,"analyzedSha":"81571269addb6bafb589a920b2883f1e1e084fd1","analyzedAt":"2026-08-12T21:51:44.981Z","schemaVersion":2},"datasetVersion":"2026-08-12T23:17:12.415Z"}