CherryHQ/cherry-studio · warning · McpError
InvalidParams
InvalidParams
Error message
Unknown action "${action}", expected add/list/remove What it means
Inside the CRON_TOOL case, args.action is dispatched over add/list/remove; any other value falls to default and throws an McpError with ErrorCode.InvalidParams. The tool's inputSchema declares action enum ['add','list','remove'] and required ['action'], so a non-enum or missing action is rejected at runtime.
Source
Thrown at src/main/ai/mcp/servers/cherryAutonomyTools.ts:291
handles(toolName: string): boolean {
return AUTONOMY_TOOLS.some((tool) => tool.name === toolName)
}
async call(toolName: string, args: Record<string, unknown>): Promise<CallToolResult> {
try {
switch (toolName) {
case CRON_TOOL_NAME: {
const action = args.action
switch (action) {
case 'add':
return await this.addJob(args)
case 'list':
return this.listJobs()
case 'remove':
return await this.removeJob(args)
default:
throw new McpError(ErrorCode.InvalidParams, `Unknown action "${action}", expected add/list/remove`)
}
}
case NOTIFY_TOOL_NAME:
return await this.sendNotification(args)
case CONFIG_TOOL_NAME: {
const action = args.action
switch (action) {
case 'status':
return this.configStatus()
case 'rename':
return this.configRename(args)
case 'add_channel':
return await this.configAddChannel(args)
case 'update_channel':
return await this.configUpdateChannel(args)
case 'remove_channel':
return await this.configRemoveChannel(args)
case 'reconnect_channel':View on GitHub (pinned to 726446b54c)
Solutions
- Use exactly one of 'add', 'list', or 'remove' for the cron tool's action field.
- If validating client-side, constrain to the inputSchema enum before sending.
- On error, surface the allowed set to the agent so it can retry with the correct verb.
Example fix
// before
{ action: 'delete', id: 'abc' }
// after
{ action: 'remove', id: 'abc' } Defensive patterns
Strategy: validation
Validate before calling
const CRON_ACTIONS = new Set(['add', 'list', 'remove'])
function validateCronAction(action: unknown): 'add' | 'list' | 'remove' {
if (typeof action !== 'string' || !CRON_ACTIONS.has(action)) {
throw new Error(`Unknown cron action "${action}". Use add/list/remove.`)
}
return action as 'add' | 'list' | 'remove'
} Type guard
function isCronAction(v: unknown): v is 'add' | 'list' | 'remove' {
return v === 'add' || v === 'list' || v === 'remove'
} Try / catch
if (!isCronAction(args.action)) {
return { content: [{ type: 'text', text: `action must be add/list/remove` }], isError: true }
} Prevention
- Constrain action to the enum before sending.
- Use 'remove' not 'delete'.
- Re-read the tool description if unsure of the action set.
When it happens
Trigger: Calling the cron tool with action 'delete', 'create', 'get', undefined, or any value outside add/list/remove.
Common situations: Agent uses a synonym ('delete' instead of 'remove'); omits action; passes a typo like 'lst'; a stale client assumes an older action name.
Related errors
- Invalid duration: "${duration}". Use formats like '30m', '2h
- MethodNotFound
- Invalid command: command must be a non-empty string
- Invalid command: command cannot be empty
- Invalid args: must be an array
AI-assisted analysis of CherryHQ/cherry-studio@726446b54c (2026-08-12).
Data as JSON: /api/errors/3fbc3eb53f7034e0.
Report an issue: GitHub.