{"record":{"id":"95b86aca4ee19ed6","repo":"theonedev/onedev","slug":"title-is-required","errorCode":null,"errorMessage":"Title is required","messagePattern":"Title is required","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/ai/IssueHelper.java","lineNumber":275,"sourceCode":"        for (var field : OneDev.getInstance(SettingService.class).getIssueSetting().getFieldSpecs()) {\n            var paramName = getParamName(field.getName());\n            if (!paramName.equals(field.getName()) && data.containsKey(paramName)) {\n                data.put(field.getName(), data.get(paramName));\n                data.remove(paramName);\n            }\n        }\n    }\n\n    @SuppressWarnings(\"unchecked\")\n    public static Issue createIssue(Subject subject, Project project, Map<String, Serializable> data) {\n        normalizeData(data);\n\n        var issueSetting = OneDev.getInstance(SettingService.class).getIssueSetting();\n\n        Issue issue = new Issue();\n        var title = (String) data.remove(\"title\");\n        if (title == null)\n            throw new ExplicitException(\"Title is required\");\n        issue.setTitle(title);\n        var description = (String) data.remove(\"description\");\n        issue.setDescription(description);\n        var confidential = (Boolean) data.remove(\"confidential\");\n        if (confidential != null)\n            issue.setConfidential(confidential);\n\n        Integer ownEstimatedTime = (Integer) data.remove(\"ownEstimatedTime\");\n        if (ownEstimatedTime != null) {\n            var subscriptionService = OneDev.getInstance(SubscriptionService.class);\n            if (!subscriptionService.isSubscriptionActive())\n                throw new ExplicitException(\"An active subscription is required for this feature\");\n            if (!project.isTimeTracking())\n                throw new ExplicitException(\"Time tracking needs to be enabled for the project\");\n            if (!SecurityUtils.canScheduleIssues(subject, project))\n                throw new UnauthorizedException(\"Issue schedule permission required to set own estimated time\");\n            issue.setOwnEstimatedTime(ownEstimatedTime * 60);\n        }","sourceCodeStart":257,"sourceCodeEnd":293,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/ai/IssueHelper.java#L257-L293","documentation":"IssueHelper.createIssue builds an Issue from a data map (typically supplied by an AI tool call). The 'title' key is mandatory; if absent (null after removal from the map), the method throws this ExplicitException before creating the issue.","triggerScenarios":"Calling createIssue (directly or via the AI issue-creation tool) with a data map that has no \"title\" entry.","commonSituations":"AI model generating issue-creation arguments without a title field; API/automation scripts omitting the title; JSON payload key misspelled or empty string normalized away upstream.","solutions":["Include a non-null \"title\" key in the data passed to createIssue","If driven by an AI tool call, check the arguments the model produced and correct the tool schema/prompt so title is always provided","Validate the payload before invoking the helper"],"exampleFix":"// before\nMap<String, Object> data = Map.of(\"description\", \"bug details\");\nissueHelper.createIssue(project, user, data);\n// after\nMap<String, Object> data = new HashMap<>();\ndata.put(\"title\", \"Fix login NPE\");\ndata.put(\"description\", \"bug details\");\nissueHelper.createIssue(project, user, data);","handlingStrategy":"validation","validationCode":"// before calling createIssue\nif (data.get(\"title\") == null || data.get(\"title\").toString().isBlank())\n    throw new IllegalArgumentException(\"title is required\");","typeGuard":null,"tryCatchPattern":"try {\n    issueHelper.createIssue(project, subject, data);\n} catch (ExplicitException e) {\n    if (\"Title is required\".equals(e.getMessage())) {\n        // prompt user / model for a title and retry\n    }\n}","preventionTips":["Always include a title in issue-creation payloads","Make title a required field in any AI tool schema for issue creation","Validate payloads before invoking the helper"],"tags":["validation","issues","required-field"],"backgroundTag":"missing-required-argument","analyzedSha":"d44925c47c37992c828ea673a5f9620539bc3ff2","analyzedAt":"2026-09-06T07:18:27.995Z","contentChangedAt":"2026-09-06T07:18:27.995Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}