{"record":{"id":"cb1458ca76b6627f","repo":"theonedev/onedev","slug":"no-any-issue-state-is-defined","errorCode":null,"errorMessage":"No any issue state is defined","messagePattern":"No any issue state is defined","errorType":"exception","errorClass":"ExplicitException","httpStatus":null,"severity":"error","filePath":"server-core/src/main/java/io/onedev/server/model/support/administration/GlobalIssueSetting.java","lineNumber":703,"sourceCode":"\t\t}\n\t\t\n\t\tindex = 1;\n\t\tfor (IssueTemplate template: getIssueTemplates()) \n\t\t\tusage.add(template.getQueryUpdater().onDeleteLink(linkName).prefix(\"description template #\" + index++));\n\t\t\n\t\tif (listLinks.contains(linkName))\n\t\t\tusage.add(new Usage().add(\"fields & links\").prefix(\"-> issues\"));\n\t\t\n\t\tusage.add(timeTrackingSetting.onDeleteLink(linkName).prefix(\"time tracking\"));\n\t\t\n\t\treturn usage.prefix(\"issue settings\");\n\t}\n\t\n\tpublic StateSpec getInitialStateSpec() {\n\t\tif (!getStateSpecs().isEmpty())\n\t\t\treturn getStateSpecs().iterator().next();\n\t\telse\n\t\t\tthrow new ExplicitException(\"No any issue state is defined\");\n\t}\n\t\n\t@NotNull\n\t@Valid\n\tpublic List<BoardSpec> getBoardSpecs() {\n\t\treturn boardSpecs;\n\t}\n\n\tpublic void setBoardSpecs(List<BoardSpec> boardSpecs) {\n\t\tthis.boardSpecs = boardSpecs;\n\t}\n\n\t@NotNull\n\t@Valid\n\tpublic TimeTrackingSetting getTimeTrackingSetting() {\n\t\treturn timeTrackingSetting;\n\t}\n","sourceCodeStart":685,"sourceCodeEnd":721,"githubUrl":"https://github.com/theonedev/onedev/blob/d44925c47c37992c828ea673a5f9620539bc3ff2/server-core/src/main/java/io/onedev/server/model/support/administration/GlobalIssueSetting.java#L685-L721","documentation":"GlobalIssueSetting.getInitialStateSpec() returns the first state in the configured issue states list as the initial state. If no issue states are defined at all (empty stateSpecs), there is no valid initial state, so it throws this ExplicitException. This indicates broken/corrupted global issue configuration.","triggerScenarios":"Accessing getInitialStateSpec() (e.g. during issue creation, issue listing, or setting validation) when the global issue setting's state list is empty.","commonSituations":"Administrator cleared all states in Administration → Issue Settings; corrupted or manually edited settings DB rows; fresh/custom setups where default states were removed before any issue workflow is used.","solutions":["Go to Administration → Issue Settings → States and add at least one state (e.g. 'Open'), making it first so it becomes the initial state","Restore default issue states by resetting the GlobalIssueSetting to defaults","Check the DB settings row if the UI appears correct — the stateSpecs list may be empty due to a serialization issue"],"exampleFix":"// before (unsafe)\nStateSpec initial = OneDev.getInstance(SettingService.class).getIssueSetting().getInitialStateSpec();\n// after\nvar issueSetting = OneDev.getInstance(SettingService.class).getIssueSetting();\nif (issueSetting.getStateSpecs().isEmpty()) {\n    logger.error(\"No issue states configured\");\n    return;\n}\nStateSpec initial = issueSetting.getInitialStateSpec();","handlingStrategy":"validation","validationCode":"var setting = OneDev.getInstance(SettingService.class).getIssueSetting();\nboolean ok = !setting.getStateSpecs().isEmpty();","typeGuard":"boolean hasIssueStates(GlobalIssueSetting s) { return !s.getStateSpecs().isEmpty(); }","tryCatchPattern":"try {\n    var initial = setting.getInitialStateSpec();\n} catch (ExplicitException e) {\n    logger.error(\"Issue states not configured\", e);\n}","preventionTips":["Keep at least one state defined in Administration → Issue Settings","Prevent admins from deleting all states (validate on save)","Snapshot settings before bulk edits"],"tags":["issues","configuration","onedev"],"backgroundTag":"missing-required-config","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"}