jd-opensource/joyagent-jdgenie · error · IllegalArgumentException
title, and steps are required for create command
Error message
title, and steps are required for create command
What it means
PlanningTool.createPlan (the create command handler) throws IllegalArgumentException when either title or steps is missing from the params map. Both fields are required to build a new plan via Plan.create.
Solutions
- Pass both title (String) and steps (List) with the create command
- Mark both fields required in the tool's JSON schema
- Validate params before invoking the tool
Example fix
// before
planningTool.execute(Map.of("command", "create", "title", "My plan"));
// after
planningTool.execute(Map.of("command", "create", "title", "My plan", "steps", List.of("step1"))); Defensive patterns
Strategy: validation
Validate before calling
if (params.get("title") == null || params.get("steps") == null) { throw new IllegalArgumentException("title and steps required for create"); } Try / catch
try {
return planningTool.execute(params);
} catch (IllegalArgumentException e) {
if (e.getMessage().contains("required for create")) { /* supply missing fields */ }
throw e;
} Prevention
- Mark title/steps required in the tool schema
- Validate create params before invocation
- Test prompts that emit create commands
When it happens
Trigger: Calling execute with command=create but omitting title or steps (null) from the params Map.
Common situations: LLM omitting optional-looking fields, schema not marking fields required, or programmatically building params and forgetting steps.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- Command is required
- Input must be a Map
- Unknown command: " + command
- A plan already exists. Delete the current plan first.
- step_index is required for mark_step command
AI-assisted analysis of jd-opensource/joyagent-jdgenie@2417e0b8b6 (2026-09-08).
Data as JSON: /api/errors/869d519558740428.
Report an issue: GitHub.
Appendix: source
Thrown at genie-backend/src/main/java/com/jd/genie/agent/tool/common/PlanningTool.java:145
if (command == null || command.isEmpty()) {
throw new IllegalArgumentException("Command is required");
}
Function<Map<String, Object>, String> handler = commandHandlers.get(command);
if (handler != null) {
return handler.apply(params);
} else {
throw new IllegalArgumentException("Unknown command: " + command);
}
}
private String createPlan(Map<String, Object> params) {
String title = (String) params.get("title");
List<String> steps = (List<String>) params.get("steps");
if (title == null || steps == null) {
throw new IllegalArgumentException("title, and steps are required for create command");
}
if (plan != null) {
throw new IllegalStateException("A plan already exists. Delete the current plan first.");
}
plan = Plan.create(title, steps);
return "我已创建plan";
}
private String updatePlan(Map<String, Object> params) {
String title = (String) params.get("title");
List<String> steps = (List<String>) params.get("steps");
if (plan == null) {
throw new IllegalStateException("No plan exists. Create a plan first.");
}
View on GitHub (pinned to 2417e0b8b6)