{"record":{"id":"467efcd6d2d254f0","repo":"deeplearning4j/deeplearning4j","slug":"integer-range-badly-formed-rng","errorCode":null,"errorMessage":"integer range badly formed: {rng}","messagePattern":"integer range badly formed: (.+?)","errorType":"exception","errorClass":"IllegalArgumentException","httpStatus":null,"severity":"critical","filePath":"datavec/datavec-api/src/main/java/org/datavec/api/conf/Configuration.java","lineNumber":629,"sourceCode":"     * above means 2, 3, 5, and 7, 8, 9, ...\n     */\n    public static class IntegerRanges {\n        private static class Range {\n            int start;\n            int end;\n        }\n\n        List<Range> ranges = new ArrayList<Range>();\n\n        public IntegerRanges() {}\n\n        public IntegerRanges(String newValue) {\n            StringTokenizer itr = new StringTokenizer(newValue, \",\");\n            while (itr.hasMoreTokens()) {\n                String rng = itr.nextToken().trim();\n                String[] parts = rng.split(\"-\", 3);\n                if (parts.length < 1 || parts.length > 2) {\n                    throw new IllegalArgumentException(\"integer range badly formed: \" + rng);\n                }\n                Range r = new Range();\n                r.start = convertToInt(parts[0], 0);\n                if (parts.length == 2) {\n                    r.end = convertToInt(parts[1], Integer.MAX_VALUE);\n                } else {\n                    r.end = r.start;\n                }\n                if (r.start > r.end) {\n                    throw new IllegalArgumentException(\"IntegerRange from \" + r.start + \" to \" + r.end + \" is invalid\");\n                }\n                ranges.add(r);\n            }\n        }\n\n        /**\n         * Convert a string to an int treating empty strings as the default value.\n         * @param value the string value","sourceCodeStart":611,"sourceCodeEnd":647,"githubUrl":"https://github.com/deeplearning4j/deeplearning4j/blob/4c22ac5fe4a8350d05d224e7f4499429f7f69c93/datavec/datavec-api/src/main/java/org/datavec/api/conf/Configuration.java#L611-L647","documentation":"The catch-all branch of the backward-cpp terminate handler in libnd4j. When std::terminate fires with something that is NOT derived from std::exception (e.g. `throw 42;`, a thrown pointer, or a rethrown foreign exception), the handler cannot print a type or message and falls back to 'Unknown exception type'. It signals that native code threw a non-standard object and the process is about to abort after a stack trace.","triggerScenarios":"A `throw` of a non-std::exception value, or a foreign exception (e.g. propagating through JNI from code built with different exception ABI) reaches std::terminate and is handled by `catch (...)`.","commonSituations":"Mixed-ABI native builds (different compilers/flags) where exceptions cross shared-library boundaries incorrectly; legacy code throwing ints or char*; CUDA kernel callbacks throwing non-exception values.","solutions":["Use the printed stack trace to locate the throw site; convert all throws in custom code to std::runtime_error subclasses.","Audit for cross-ABI exception passing and rebuild all native modules with a consistent compiler and -fexceptions settings.","Run with catchthrow (gdb: `catch throw`) to capture the original throw before it becomes terminate.","Check for exceptions crossing CUDA host/device or JNI boundaries and translate them at each boundary."],"exampleFix":"// before\nthrow -1;\n// after\nthrow std::runtime_error(\"kernel launch failed\");","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { nativeCall(); } catch (...) { convertToJavaException(\"unknown native error\"); }","preventionTips":["Throw only std::exception-derived types in native code","Keep compiler/exception ABI consistent across all native modules","Never let exceptions cross CUDA or JNI boundaries unconverted"],"tags":["cpp","unknown-exception","terminate","abi"],"backgroundTag":"uncaught-exception-terminate","analyzedSha":"4c22ac5fe4a8350d05d224e7f4499429f7f69c93","analyzedAt":"2026-09-07T05:27:04.714Z","contentChangedAt":"2026-09-07T05:27:04.714Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}