{"record":{"id":"363997eec5bc9dcc","repo":"Activiti/Activiti","slug":"illegal-value-for-history-level","errorCode":null,"errorMessage":"Illegal value for history-level: ","messagePattern":"Illegal value for history-level: ","errorType":"validation","errorClass":"ActivitiIllegalArgumentException","httpStatus":null,"severity":"error","filePath":"activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/history/HistoryLevel.java","lineNumber":51,"sourceCode":"\n    private HistoryLevel(String key) {\n        this.key = key;\n    }\n\n    /**\n     * @param key\n     *          string representation of level\n     * @return {@link HistoryLevel} for the given key\n     * @throws ActivitiException\n     *           when passed in key doesn't correspond to existing level\n     */\n    public static HistoryLevel getHistoryLevelForKey(String key) {\n        for (HistoryLevel level : values()) {\n            if (level.key.equals(key)) {\n                return level;\n            }\n        }\n        throw new ActivitiIllegalArgumentException(\"Illegal value for history-level: \" + key);\n    }\n\n    /**\n     * String representation of this history-level.\n     */\n    public String getKey() {\n        return key;\n    }\n\n    /**\n     * Checks if the given level is the same as, or higher in order than the level this method is executed on.\n     */\n    public boolean isAtLeast(HistoryLevel level) {\n        // Comparing enums actually compares the location of values declared in\n        // the enum\n        return this.compareTo(level) >= 0;\n    }\n}","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/Activiti/Activiti/blob/56435b1a97deeafdc09dd40074b056c89fba5a8a/activiti-core/activiti-engine/src/main/java/org/activiti/engine/impl/history/HistoryLevel.java#L33-L69","documentation":"Thrown by HistoryLevel.getHistoryLevelForKey when the configured history-level string does not match any known level key (none, activity, audit, full), so engine configuration cannot resolve a history level. The offending key is appended to the message.","triggerScenarios":"Passing a history-level string via processEngineConfiguration.setHistory(...) or the activiti.properties/Spring config that is not one of the supported keys.","commonSituations":"Typos like 'Audit' (case-sensitive) or 'auditing'; copying config from other engines (e.g. Flowable/CRM history levels); environment variables injecting wrong values.","solutions":["Use one of: none, activity, audit, full (exact lowercase keys).","Check the value injected for processEngineConfiguration.setHistory / historyLevel property.","If reading from config files/env, log and normalize the value (trim, lowercase) before passing.","Consider using HistoryLevel enum directly instead of string keys to fail at compile time."],"exampleFix":"// before\nconfig.setHistory(\"Auditing\");\n// after\nconfig.setHistory(\"audit\"); // one of none|activity|audit|full","handlingStrategy":"validation","validationCode":"List<String> valid = Arrays.asList(\"none\",\"activity\",\"audit\",\"full\");\nif (!valid.contains(historyLevel)) throw new IllegalArgumentException(\"illegal history-level: \" + historyLevel);","typeGuard":null,"tryCatchPattern":"try { config.setHistory(rawLevel); } catch (ActivitiIllegalArgumentException e) { config.setHistory(\"audit\"); }","preventionTips":["Only use exact lowercase keys: none, activity, audit, full.","Centralize history-level constants in code instead of ad-hoc strings.","Normalize env/config strings (trim/lowercase) before applying."],"tags":["activiti","configuration","history-level","invalid-value"],"backgroundTag":"invalid-enum-value","analyzedSha":"56435b1a97deeafdc09dd40074b056c89fba5a8a","analyzedAt":"2026-09-09T21:00:06.703Z","contentChangedAt":"2026-09-09T21:00:06.703Z","schemaVersion":2},"datasetVersion":"2026-09-17T15:17:12.973Z"}