chatboxai/chatbox · warning · ChatboxCliUsageError

Missing setting key.

Error message

Missing setting key.

What it means

Thrown by the `settings get` command handler when no positional argument is supplied, i.e. parsed.positionals[0] is falsy. The command requires exactly one key argument, so an empty invocation is treated as a usage error rather than a no-op.

Source

Thrown at src/renderer/packages/chatbox-cli/settings.ts:144

      return {
        readOnly: true,
        changeGuidance: 'Guide the user to the listed Chatbox Settings page to make changes manually.',
        settings: safeSettings.map((setting) => ({
          key: setting.key,
          value: setting.read(),
          description: setting.description,
          location: `Settings > ${setting.page}`,
        })),
      }
    },
  },
  {
    path: ['settings', 'get'],
    description: 'Read one allowlisted setting.',
    usage: 'chatbox settings get <key>',
    execute({ parsed }) {
      const key = parsed.positionals[0]
      if (!key) throw new ChatboxCliUsageError('Missing setting key.')
      const setting = findSetting(key)
      return {
        readOnly: true,
        key,
        value: setting.read(),
        description: setting.description,
        location: `Settings > ${setting.page}`,
        changeGuidance: manualChangeGuidance(setting.page),
      }
    },
  },
]

View on GitHub (pinned to 81571269ad)

Solutions

  1. Supply a key: `chatbox settings get <key>`.
  2. Run `chatbox settings list` first to discover valid keys.
  3. If scripting, guard against the empty-variable case before invoking the command.

Example fix

// before
chatbox settings get

// after
chatbox settings get app.startup-page
Defensive patterns

Strategy: validation

Validate before calling

const key = parsed.positionals[0]
if (!key) {
  // print usage and exit 2 instead of calling the handler
  console.error('Usage: chatbox settings get <key>')
  process.exit(2)
}

Type guard

function hasPositional(pos: unknown): pos is string {
  return typeof pos === 'string' && pos.length > 0
}

Try / catch

try {
  // handler throws if missing
} catch (e) {
  if (e instanceof ChatboxCliUsageError && e.message === 'Missing setting key.') {
    // render input prompt for the key
  }
}

Prevention

When it happens

Trigger: Running `chatbox settings get` with no trailing key argument. The guard is `const key = parsed.positionals[0]; if (!key) throw ...`.

Common situations: User forgets the key; a wrapper script invokes the command with an empty/unset variable; user runs the bare command expecting a list.

Related errors


AI-assisted analysis of chatboxai/chatbox@81571269ad (2026-08-12). Data as JSON: /api/errors/f6c1c325c397e724. Report an issue: GitHub.