{"record":{"id":"b52bc666189ea496","repo":"stanfordnlp/CoreNLP","slug":"arabic-does-not-support-feature-type-feat-tos","errorCode":null,"errorMessage":"Arabic does not support feature type: \" + feat.toString()","messagePattern":"Arabic does not support feature type: \" \\+ feat\\.toString\\(\\)","errorType":"exception","errorClass":"java.lang.IllegalArgumentException","httpStatus":null,"severity":"error","filePath":"src/edu/stanford/nlp/international/arabic/ArabicMorphoFeatureSpecification.java","lineNumber":71,"sourceCode":"    else if(feat == MorphoFeatureType.CASE) {\n      throw new RuntimeException(this.getClass().getName() + \": Case is presently unsupported!\");\n//      return Arrays.asList(caseVals);\n    } else if(feat == MorphoFeatureType.GEN)\n      return Arrays.asList(genVals);\n    else if(feat == MorphoFeatureType.NUM)\n      return Arrays.asList(numVals);\n    else if(feat == MorphoFeatureType.PER)\n      return Arrays.asList(perVals);\n    else if(feat == MorphoFeatureType.POSS)\n      return Arrays.asList(possVals);\n    else if(feat == MorphoFeatureType.VOICE)\n      return Arrays.asList(voiceVals);\n    else if(feat == MorphoFeatureType.MOOD)\n      return Arrays.asList(moodVals);\n    else if(feat == MorphoFeatureType.TENSE)\n      return Arrays.asList(tenseVals);\n    else\n      throw new IllegalArgumentException(\"Arabic does not support feature type: \" + feat.toString());\n  }\n\n  /**\n   * Hand-written rules to convert SAMA analyses to feature structures.\n   */\n  @Override\n  public MorphoFeatures strToFeatures(String spec) {\n    MorphoFeatures features = new ArabicMorphoFeatures();\n\n    // Check for the boundary symbol\n    if(spec == null || spec.equals(\"\")) {\n      return features;\n    }\n    //Possessiveness\n    if(isActive(MorphoFeatureType.POSS) && spec.contains(\"POSS\")) {\n      features.addFeature(MorphoFeatureType.POSS,possVals[0]);\n    }\n","sourceCodeStart":53,"sourceCodeEnd":89,"githubUrl":"https://github.com/stanfordnlp/CoreNLP/blob/1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a/src/edu/stanford/nlp/international/arabic/ArabicMorphoFeatureSpecification.java#L53-L89","documentation":"ArabicMorphoFeatureSpecification.getValues throws this IllegalArgumentException when queried with a MorphoFeatureType the Arabic specification does not implement at all (anything other than DEF, CASE, GEN, NUM, PER, VOICE, MOOD, TENSE). It is the terminal else-branch of the feature dispatch, signaling an unrecognized or not-modeled feature type for Arabic.","triggerScenarios":"Calling getValues(feat) with a MorphoFeatureType outside the Arabic-supported set — e.g. a feature added in a newer CoreNLP version, or a custom/other-language feature type passed to the Arabic specification.","commonSituations":"Generic code iterating all enum values across language-specific specifications; mixing specifications so an English-only feature type reaches the Arabic handler; upgrading CoreNLP and getting a new MorphoFeatureType that the Arabic branch predates.","solutions":["Restrict feature queries to the types the Arabic spec supports (DEF, GEN, NUM, PER, VOICE, MOOD, TENSE).","Filter the MorphoFeatureType set before calling getValues for Arabic documents.","Ensure you are using the morpho feature specification matching your language/pipeline.","If you control the code, add an explicit supportedFeatures() check instead of relying on the exception."],"exampleFix":"// before\nList<String> vals = arabicSpec.getValues(someNewFeatureType);\n// after\nif (EnumSet.of(DEF, GEN, NUM, PER, VOICE, MOOD, TENSE).contains(someNewFeatureType)) {\n  List<String> vals = arabicSpec.getValues(someNewFeatureType);\n}","handlingStrategy":"type-guard","validationCode":"// java\nprivate static final Set<MorphoFeatureType> ARABIC_SUPPORTED = EnumSet.of(\n    MorphoFeatureType.DEF, MorphoFeatureType.GEN, MorphoFeatureType.NUM,\n    MorphoFeatureType.PER, MorphoFeatureType.VOICE, MorphoFeatureType.MOOD,\n    MorphoFeatureType.TENSE);\nboolean ok = ARABIC_SUPPORTED.contains(feat);","typeGuard":"// java\nif (!ARABIC_SUPPORTED.contains(feat)) return Collections.emptyList();\nList<String> vals = arabicSpec.getValues(feat);","tryCatchPattern":"try {\n  vals = arabicSpec.getValues(feat);\n} catch (IllegalArgumentException e) {\n  if (e.getMessage() != null && e.getMessage().startsWith(\"Arabic does not support feature type\")) {\n    vals = Collections.emptyList();\n  } else throw e;\n}","preventionTips":["Whitelist Arabic-supported feature types instead of relying on enum iteration.","Re-check the supported set when upgrading CoreNLP versions (new enum values may appear).","Keep language-specific feature handling in separate code paths."],"tags":["java","nlp","arabic","enum"],"backgroundTag":"unsupported-enum-value","analyzedSha":"1b7edd19c4d0d7b1f13a2591425b9b60a0b1af7a","analyzedAt":"2026-09-10T02:24:07.274Z","contentChangedAt":"2026-09-10T02:24:07.274Z","schemaVersion":2},"datasetVersion":"2026-09-15T23:17:13.987Z"}