stanfordnlp/CoreNLP · error · RuntimeException
only support settings for CTB and PK now.
Error message
only support settings for CTB and PK now.
What it means
TagAffixDetector picks character-list and affix dictionary paths for char-based POS features. When useChPos/useCTBChar2/usePKChar2 is on but one of the unsupported ASBC/HK/MSR char2 flags is also set, it throws RuntimeException because path lists exist only for CTB and PK.
Solutions
- Turn off useASBCChar2/useHKChar2/useMSRChar2 and keep only useCTBChar2 or usePKChar2
- If you need ASBC/HK/MSR support, supply your own character-list and in.* dictionary paths (requires code change)
- Review the properties file so exactly one corpus char2 flag is enabled
Example fix
// before (Properties) useCTBChar2=true useMSRChar2=true // after (Properties) useCTBChar2=true useMSRChar2=false
Defensive patterns
Strategy: validation
Validate before calling
Properties p = /* props */;
boolean char2on = Boolean.parseBoolean(p.getProperty("useChPos","false"))
|| Boolean.parseBoolean(p.getProperty("useCTBChar2","false"))
|| Boolean.parseBoolean(p.getProperty("usePKChar2","false"));
boolean unsupported = Boolean.parseBoolean(p.getProperty("useASBCChar2","false"))
|| Boolean.parseBoolean(p.getProperty("useHKChar2","false"))
|| Boolean.parseBoolean(p.getProperty("useMSRChar2","false"));
if (char2on && unsupported) {
throw new IllegalArgumentException("TagAffixDetector supports only CTB/PK char2 settings");
} Try / catch
try {
new TagAffixDetector(flags);
} catch (RuntimeException e) {
if (e.getMessage().contains("CTB and PK")) {
flags.useMSRChar2 = false;
new TagAffixDetector(flags);
} else throw e;
} Prevention
- Enable exactly one corpus char2 flag (CTB or PK) per configuration
- Never combine ASBC/HK/MSR char2 flags with useChPos
- Validate props files with a small preflight script before launching training
When it happens
Trigger: Constructing TagAffixDetector with (useChPos || useCTBChar2 || usePKChar2) AND (useASBCChar2 || useHKChar2 || useMSRChar2) true.
Common situations: Enabling multiple corpus flags together by mistake (e.g. copying a properties file for MSR data while leaving CTB/PK flags on); trying to use tag-affix detection with ASBC/HK/MSR corpora.
Understand the failure class
Background: Conflicting config options: "cannot be used together" — configuration validation errors across open-source libraries — this error's family across 162 libraries.
Related errors
- none of flags.useXXXChar2 are on
- only support settings for CTB and PK now.
- only support settings for CTB and PK now.
- only support settings for CTB and PKU now.
- Both parse.model and parse.executable properties must be…
AI-assisted analysis of stanfordnlp/CoreNLP@1b7edd19c4 (2026-09-10).
Data as JSON: /api/errors/ead25221e0d878f0.
Report an issue: GitHub.
Appendix: source
Thrown at src/edu/stanford/nlp/wordseg/TagAffixDetector.java:35
public TagAffixDetector(SeqClassifierFlags flags) {
String corporaDict;
if (flags.sighanCorporaDict != null) {
corporaDict = flags.sighanCorporaDict;
} else {
corporaDict = DEFAULT_CORPORA_DICT;
}
if ( ! corporaDict.isEmpty() && ! corporaDict.endsWith("/")) {
corporaDict = corporaDict + '/';
}
String ccPath;
String adPath;
if (flags.useChPos || flags.useCTBChar2 || flags.usePKChar2) {
// if we're using POS information, override the ccPath
// For now we only have list for CTB and PK
if (flags.useASBCChar2 || flags.useHKChar2 || flags.useMSRChar2) {
throw new RuntimeException("only support settings for CTB and PK now.");
} else if (flags.useCTBChar2) {
ccPath = corporaDict+"dict/character_list";
adPath = corporaDict+"dict/in.ctb";
} else if (flags.usePKChar2) {
ccPath = corporaDict+"dict/pos_open/character_list.pku.utf8";
adPath = corporaDict+"dict/in.pk";
} else {
throw new RuntimeException("none of flags.useXXXChar2 are on");
}
} else {
ccPath = corporaDict+"dict/pos_close/char.ctb.list";
adPath = corporaDict+"dict/in.ctb";
}
if (VERBOSE) {
logger.info("TagAffixDetector: useChPos=" + flags.useChPos +
" | useCTBChar2=" + flags.useCTBChar2 + " | usePKChar2=" + flags.usePKChar2);
logger.info("TagAffixDetector: building TagAffixDetector from " + ccPath + " and " + adPath);
}View on GitHub (pinned to 1b7edd19c4)