{"record":{"id":"869d519558740428","repo":"jd-opensource/joyagent-jdgenie","slug":"title-and-steps-are-required-for-create-command","errorCode":null,"errorMessage":"title, and steps are required for create command","messagePattern":"title, and steps are required for create command","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"genie-backend/src/main/java/com/jd/genie/agent/tool/common/PlanningTool.java","lineNumber":145,"sourceCode":"\n        if (command == null || command.isEmpty()) {\n            throw new IllegalArgumentException(\"Command is required\");\n        }\n\n        Function<Map<String, Object>, String> handler = commandHandlers.get(command);\n        if (handler != null) {\n            return handler.apply(params);\n        } else {\n            throw new IllegalArgumentException(\"Unknown command: \" + command);\n        }\n    }\n\n    private String createPlan(Map<String, Object> params) {\n        String title = (String) params.get(\"title\");\n        List<String> steps = (List<String>) params.get(\"steps\");\n\n        if (title == null || steps == null) {\n            throw new IllegalArgumentException(\"title, and steps are required for create command\");\n        }\n\n        if (plan != null) {\n            throw new IllegalStateException(\"A plan already exists. Delete the current plan first.\");\n        }\n\n        plan = Plan.create(title, steps);\n        return \"我已创建plan\";\n    }\n\n    private String updatePlan(Map<String, Object> params) {\n        String title = (String) params.get(\"title\");\n        List<String> steps = (List<String>) params.get(\"steps\");\n\n        if (plan == null) {\n            throw new IllegalStateException(\"No plan exists. Create a plan first.\");\n        }\n","sourceCodeStart":127,"sourceCodeEnd":163,"githubUrl":"https://github.com/jd-opensource/joyagent-jdgenie/blob/2417e0b8b636d941ad5fb14c59b20dddfef5375d/genie-backend/src/main/java/com/jd/genie/agent/tool/common/PlanningTool.java#L127-L163","documentation":"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.","triggerScenarios":"Calling execute with command=create but omitting title or steps (null) from the params Map.","commonSituations":"LLM omitting optional-looking fields, schema not marking fields required, or programmatically building params and forgetting steps.","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"],"exampleFix":"// before\nplanningTool.execute(Map.of(\"command\", \"create\", \"title\", \"My plan\"));\n// after\nplanningTool.execute(Map.of(\"command\", \"create\", \"title\", \"My plan\", \"steps\", List.of(\"step1\")));","handlingStrategy":"validation","validationCode":"if (params.get(\"title\") == null || params.get(\"steps\") == null) { throw new IllegalArgumentException(\"title and steps required for create\"); }","typeGuard":null,"tryCatchPattern":"try {\n    return planningTool.execute(params);\n} catch (IllegalArgumentException e) {\n    if (e.getMessage().contains(\"required for create\")) { /* supply missing fields */ }\n    throw e;\n}","preventionTips":["Mark title/steps required in the tool schema","Validate create params before invocation","Test prompts that emit create commands"],"tags":["java","tool","missing-argument"],"backgroundTag":"missing-required-argument","analyzedSha":"2417e0b8b636d941ad5fb14c59b20dddfef5375d","analyzedAt":"2026-09-08T11:28:19.414Z","contentChangedAt":"2026-09-08T11:28:19.414Z","schemaVersion":2},"datasetVersion":"2026-09-16T09:17:16.951Z"}