chatboxai/chatbox · warning · Error
A license key is required to claim the Agent Mode reward
Error message
A license key is required to claim the Agent Mode reward
What it means
Thrown by claimFreeAgentModeReward() when the supplied license key is empty after trimming. It is a pre-flight guard before the network call, so a blank/whitespace key never reaches the API. The check is `if (!normalizedLicenseKey) throw ...`.
Source
Thrown at src/renderer/packages/remote.ts:1085
method: 'GET',
headers: {
'Content-Type': 'application/json',
...(await getChatboxHeaders()),
},
},
{
parseChatboxRemoteError: true,
retry: 2,
}
)
const json: Response = await res.json()
return json.data
}
export async function claimFreeAgentModeReward(licenseKey: string): Promise<ClaimedAgentModeReward> {
const normalizedLicenseKey = licenseKey.trim()
if (!normalizedLicenseKey) {
throw new Error('A license key is required to claim the Agent Mode reward')
}
const afetch = await getAfetch()
const res = await afetch(
`${getAPIOrigin()}/api/license/claim-free-agent-mode-reward`,
{
method: 'POST',
headers: {
...(await getChatboxHeaders()),
Authorization: `Bearer ${normalizedLicenseKey}`,
},
},
{
parseChatboxRemoteError: true,
retry: 0,
}
)
return ClaimFreeAgentModeRewardResponseSchema.parse(await res.json())View on GitHub (pinned to 81571269ad)
Solutions
- Provide a non-empty license key string.
- Disable the claim action in the UI until the trimmed input is non-empty.
- If scripting, validate the argument is a non-blank string before calling.
Defensive patterns
Strategy: validation
Validate before calling
function nonBlankKey(key: string): boolean {
return key.trim().length > 0
}
if (!nonBlankKey(licenseKey)) {
// disable claim button; do not call claimFreeAgentModeReward
} Type guard
function isNonBlankString(s: unknown): s is string {
return typeof s === 'string' && s.trim().length > 0
} Try / catch
try {
await claimFreeAgentModeReward(licenseKey)
} catch (e) {
if (e instanceof Error && e.message === 'A license key is required to claim the Agent Mode reward') {
// focus the license input
}
} Prevention
- Disable the claim action until input is non-empty.
- Trim and validate license keys in the UI.
- Never pass undefined/null from a bound variable without a default.
When it happens
Trigger: Calling claimFreeAgentModeReward(''), claimFreeAgentModeReward(' '), or with an undefined/null coerced to empty string. The trim() then emptiness check fires before getAfetch.
Common situations: UI button enabled with an empty license input; a variable bound to the input was never populated; copy-paste of whitespace-only text; programmatic call with a missing argument.
Related errors
- No authorization code found in the input
- --${name} must be an integer.
- --${name} must be between ${options.min} and ${options.max}.
- Missing setting key.
- Unmatching product
AI-assisted analysis of chatboxai/chatbox@81571269ad (2026-08-12).
Data as JSON: /api/errors/20ad1e488619d4a2.
Report an issue: GitHub.