{"record":{"id":"d2f786960690a24e","repo":"oracle/graal","slug":"stacktrace-i","errorCode":null,"errorMessage":"stackTrace[${i}]","messagePattern":"stackTrace\\[(.+?)\\]","errorType":"validation","errorClass":"NullPointerException","httpStatus":null,"severity":"error","filePath":"espresso/src/com.oracle.truffle.espresso.polyglot/src/com/oracle/truffle/espresso/polyglot/ForeignException.java","lineNumber":131,"sourceCode":"            if (Polyglot.isForeignObject(cause)) {\n                return Polyglot.cast(ForeignException.class, cause);\n            } else {\n                return (Throwable) cause;\n            }\n        }\n        return null;\n    }\n\n    /**\n     * Unsupported, {@link ForeignException} instances are by definition foreign and thus\n     * stacktraces should not be controllable by the guest.\n     */\n    @Override\n    public void setStackTrace(StackTraceElement[] stackTrace) {\n        // Validate arguments to fulfill contract.\n        for (int i = 0; i < stackTrace.length; i++) {\n            if (stackTrace[i] == null) {\n                throw new NullPointerException(\"stackTrace[\" + i + \"]\");\n            }\n        }\n    }\n\n    @SuppressWarnings(\"sync-override\")\n    @Override\n    public Throwable fillInStackTrace() {\n        return this;\n    }\n\n    @SuppressWarnings(\"sync-override\")\n    @Override\n    public Throwable initCause(Throwable cause) {\n        throw new UnsupportedOperationException();\n    }\n}\n","sourceCodeStart":113,"sourceCodeEnd":148,"githubUrl":"https://github.com/oracle/graal/blob/a66e9ccd1d7bf2552883939aa0788dfd0e294aab/espresso/src/com.oracle.truffle.espresso.polyglot/src/com/oracle/truffle/espresso/polyglot/ForeignException.java#L113-L148","documentation":"Error \"stackTrace[${i}]\" thrown in oracle/graal.","triggerScenarios":"Thrown at espresso/src/com.oracle.truffle.espresso.polyglot/src/com/oracle/truffle/espresso/polyglot/ForeignException.java:131 when the library encounters an invalid state.","commonSituations":"Occurs when a caller violates the contract guarded by this check: stackTrace[${i}]","solutions":["Fix the condition reported by the error: stackTrace[${i}]","Check the throwing call site and ensure its documented preconditions (argument values, types, environment, or configuration) are satisfied before the call."],"exampleFix":"Validate inputs and environment so that the failing condition does not occur: stackTrace[${i}]","handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a66e9ccd1d7bf2552883939aa0788dfd0e294aab","analyzedAt":"2026-08-14T13:58:47.161Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}