{"record":{"id":"e474eb30f9199756","repo":"deeplearning4j/deeplearning4j","slug":"variable-substitution-depth-too-large-max-subst","errorCode":null,"errorMessage":"Variable substitution depth too large: {MAX_SUBST} {expr}","messagePattern":"Variable substitution depth too large: (.+?) (.+?)","errorType":"exception","errorClass":"IllegalStateException","httpStatus":null,"severity":"critical","filePath":"datavec/datavec-api/src/main/java/org/datavec/api/conf/Configuration.java","lineNumber":300,"sourceCode":"            }\n            String var = match.group();\n            var = var.substring(2, var.length() - 1); // remove ${ .. }\n            String val = null;\n            try {\n                val = System.getProperty(var);\n            } catch (SecurityException se) {\n                LOG.warn(\"Unexpected SecurityException in Configuration\", se);\n            }\n            if (val == null) {\n                val = getRaw(var);\n            }\n            if (val == null) {\n                return eval; // return literal ${var}: var is unbound\n            }\n            // substitute\n            eval = eval.substring(0, match.start()) + val + eval.substring(match.end());\n        }\n        throw new IllegalStateException(\"Variable substitution depth too large: \" + MAX_SUBST + \" \" + expr);\n    }\n\n    /**\n     * Get the value of the <code>name</code> property, <code>null</code> if\n     * no such property exists.\n     *\n     * Values are processed for <a href=\"#VariableExpansion\">variable expansion</a>\n     * before being returned.\n     *\n     * @param name the property name.\n     * @return the value of the <code>name</code> property,\n     *         or null if no such property exists.\n     */\n    public String get(String name) {\n        return substituteVars(getProps().getProperty(name));\n    }\n\n    /**","sourceCodeStart":282,"sourceCodeEnd":318,"githubUrl":"https://github.com/deeplearning4j/deeplearning4j/blob/4c22ac5fe4a8350d05d224e7f4499429f7f69c93/datavec/datavec-api/src/main/java/org/datavec/api/conf/Configuration.java#L282-L318","documentation":"This is output from the std::terminate handler installed by the backward-cpp stack-trace library embedded in libnd4j. When an uncaught C++ exception (or any other terminate condition) reaches the handler, it prints the exception's runtime type name (typeid(e).name(), a mangled name like 'St13runtime_error') to stderr before dumping a stack trace. It is a diagnostic, not an error code you fix directly; the real problem is the exception that escaped.","triggerScenarios":"An uncaught C++ exception propagates out of native code without being caught at the JNI boundary, invoking the terminate handler. Also any throw of an object derived from std::exception during aborting flows that reaches std::terminate.","commonSituations":"A datatype_exception or runtime_error thrown by libnd4j kernels escapes through a NativeOps call with no Java-side native exception bridge installed; custom op code compiled without exception handling at the JNI boundary.","solutions":["Read the 'Exception message:' line printed immediately after to identify the underlying exception, and fix that root cause (e.g. dtype mismatch, bad shape).","Ensure the JNI layer catches C++ exceptions and converts them to Java exceptions instead of letting them escape.","Decode the mangled type name with `c++filt <name>` to learn the exact exception class thrown.","Re-run under a debugger with a breakpoint on std::terminate to capture the throw site."],"exampleFix":"// before: exception escapes JNI\njlong exec(jlong* ptrs) { return execBroadcast(ptrs...); } // -> std::terminate\n// after\njlong exec(jlong* ptrs) {\n  try { return execBroadcast(ptrs...); }\n  catch (const std::exception& e) { throwJavaRuntimeException(e.what()); return 0; }\n}","handlingStrategy":"try-catch","validationCode":"// Java/JNI: wrap every native call\ntry { nativeExec(args); } catch (Throwable t) { log(\"native op failed\", t); }","typeGuard":null,"tryCatchPattern":"try { nativeCall(); } catch (const std::exception& e) { convertToJavaException(e.what()); }","preventionTips":["Always convert C++ exceptions to Java exceptions at the JNI boundary","Validate dtypes/shapes in Java before native calls","Run native code in a watchdog-enabled JVM so SIGABRT is observable"],"tags":["cpp","uncaught-exception","stderr","diagnostics"],"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"}