{"record":{"id":"7e0dbc35868d98e7","repo":"languagetool-org/languagetool","slug":"no-issuetype-found-for-name-name-valid","errorCode":null,"errorMessage":"No IssueType found for name '\" + name + \"'. Valid values: \" + Arrays.toString(values())","messagePattern":"No IssueType found for name '\" \\+ name \\+ \"'\\. Valid values: \" \\+ Arrays\\.toString\\(values\\(\\)\\)","errorType":"validation","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"languagetool-core/src/main/java/org/languagetool/rules/ITSIssueType.java","lineNumber":46,"sourceCode":" * \n * @see <a href=\"http://www.w3.org/International/multilingualweb/lt/drafts/its20/its20.html#lqissue-typevalues\">ITS 2.0</a>\n * @since 2.5\n */\npublic enum ITSIssueType {\n\n  Terminology, Mistranslation, Omission, Untranslated, Addition, Duplication, Inconsistency, Grammar,\n  Legal, Register, LocaleSpecificContent(\"locale-specific-content\"), LocaleViolation(\"locale-violation\"),\n  Style, Characters, Misspelling, Typographical, Formatting, InconsistentEntities(\"inconsistent-entities\"),\n  Numbers, Markup, PatternProblem(\"pattern-problem\"), Whitespace, Internationalization, Length, \n  NonConformance(\"non-conformance\"), Uncategorized, Other;\n\n  public static ITSIssueType getIssueType(String name) {\n    for (ITSIssueType issueType : values()) {\n      if (issueType.toString().equals(name)) {\n        return issueType;\n      }\n    }\n    throw new IllegalArgumentException(\"No IssueType found for name '\" + name + \"'. Valid values: \" + Arrays.toString(values()));\n  }\n\n  private final String name;\n\n  ITSIssueType() {\n    this.name = name();\n  }\n\n  ITSIssueType(String name) {\n    this.name = name;\n  }\n\n  /**\n   * Use this to get the name as it is used in the ITS 2.0 standard\n   * (namely lowercase and with hyphens, not camel case)\n   */\n  @Override\n  public String toString() {","sourceCodeStart":28,"sourceCodeEnd":64,"githubUrl":"https://github.com/languagetool-org/languagetool/blob/2e990059ce67d5e2a0f7f7ca5d31160c6709df4b/languagetool-core/src/main/java/org/languagetool/rules/ITSIssueType.java#L28-L64","documentation":"ITSIssueType.getIssueType(name) maps a string to one of the ITS issue type enum values; it iterates values() and throws IllegalArgumentException if no enum constant's toString() equals the input. The message lists all valid values.","triggerScenarios":"Calling ITSIssueType.getIssueType(\"...\") with a name that is not exactly one of the enum constants (case-sensitive), typically a value read from an XML rule attribute (its:type).","commonSituations":"Typos or wrong casing in rule XML (e.g. 'grammar' vs 'Grammatical'), using free-form text instead of the ITS spec values, or mapping external categories to ITS types with values the library doesn't define.","solutions":["Compare the input name against the list in the exception message and correct it to an exact, case-sensitive enum name (e.g. 'Uncategorized', 'Grammar', 'Typographical').","Check the rule XML attribute that supplies the name and fix its value.","If the input may be absent or free-form, wrap the call or pre-validate with a whitelist before calling getIssueType."],"exampleFix":"// before\nITSIssueType type = ITSIssueType.getIssueType(\"grammar\");\n// after\nITSIssueType type = ITSIssueType.getIssueType(\"Grammatical\");","handlingStrategy":"validation","validationCode":"private static final Set<String> VALID = Arrays.stream(ITSIssueType.values())\n    .map(Enum::toString).collect(Collectors.toSet());\nif (name != null && !VALID.contains(name)) {\n  throw new IllegalArgumentException(\"Unknown ITS issue type: \" + name);\n}","typeGuard":"boolean isValidIssueType(String name) {\n  return Arrays.stream(ITSIssueType.values()).anyMatch(t -> t.toString().equals(name));\n}","tryCatchPattern":"try {\n  type = ITSIssueType.getIssueType(name);\n} catch (IllegalArgumentException e) {\n  LOG.warn(\"Unknown ITS type '{}', defaulting to Uncategorized\", name);\n  type = ITSIssueType.Uncategorized;\n}","preventionTips":["Validate rule XML against LT's schema before loading","Use enum values via IDE autocompletion instead of typing strings","Note the lookup is case-sensitive — normalize input casing at the source"],"tags":["java","languagetool","enum","illegal-argument"],"backgroundTag":"invalid-enum-value","analyzedSha":"2e990059ce67d5e2a0f7f7ca5d31160c6709df4b","analyzedAt":"2026-09-06T09:20:17.015Z","contentChangedAt":"2026-09-06T09:20:17.015Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}