quarkusio/quarkus · critical · RuntimeException

Quarkus initialization error

Error message

Quarkus initialization error

What it means

The Lambda poll loop checks that the Quarkus Application has been bootstrapped before processing events; Application.currentApplication() is null, meaning Quarkus never started. The runtime then also calls start() on the current application for each run.

Source

Thrown at extensions/amazon-lambda/common-runtime/src/main/java/io/quarkus/amazon/lambda/runtime/AbstractLambdaPollLoop.java:255

     * @throws Exception
     */
    protected abstract Object processRequest(Object input, AmazonLambdaContext context) throws Exception;

    protected abstract void processRequest(InputStream input, OutputStream output, AmazonLambdaContext context)
            throws Exception;

    protected abstract LambdaInputReader getInputReader();

    protected abstract LambdaOutputWriter getOutputWriter();

    protected AmazonLambdaContext createContext(HttpURLConnection requestConnection) throws IOException {
        return new AmazonLambdaContext(requestConnection, cognitoIdReader, clientCtxReader);
    }

    private void checkQuarkusBootstrapped() {
        // todo we need a better way to do this.
        if (Application.currentApplication() == null) {
            throw new RuntimeException("Quarkus initialization error");
        }
        String[] args = {};
        Application.currentApplication().start(args);
    }

    protected void postResponse(URL url, Object response) throws IOException {
        HttpURLConnection responseConnection = (HttpURLConnection) url.openConnection();
        responseConnection.setRequestProperty(USER_AGENT, USER_AGENT_VALUE);
        if (response != null) {
            getOutputWriter().writeHeaders(responseConnection);
        }
        responseConnection.setDoOutput(true);
        responseConnection.setRequestMethod("POST");
        if (response != null) {
            getOutputWriter().writeValue(responseConnection.getOutputStream(), response);
        }
        while (responseConnection.getInputStream().read() != -1) {
            // Read data

View on GitHub (pinned to e1c734241f)

Solutions

  1. Set the Lambda console/CLI handler to the Quarkus-provided handler (io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler::streamHandler or the event variant) instead of your own class
  2. Package via the Quarkus Amazon Lambda packaging (mvn package producing function.zip) so the bootstrap entry point is included
  3. Ensure the archive's bootstrap/main invokes the Quarkus application (run the generated handler, not a custom main)
  4. Verify you are not subclassing RequestHandler and invoking it manually outside the Quarkus runtime

Example fix

# before (AWS Lambda config)
Handler: com.acme.MyHandler::handleRequest
// after
Handler: io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler::streamHandler
Defensive patterns

Strategy: try-catch

Try / catch

try { loop.run(); } catch (RuntimeException e) { if ("Quarkus initialization error".equals(e.getMessage())) { /* reconfigure Lambda handler to QuarkusStreamHandler / republish function.zip */ } throw e; }

Prevention

When it happens

Trigger: checkQuarkusBootstrapped() is invoked from run() when Application.currentApplication() returns null, i.e. the lambda handler was invoked without Quarkus having initialized the application lifecycle.

Common situations: Deploying a handler class that bypasses Quarkus's generated handler (e.g. configuring AWS Lambda handler to the raw class instead of io.quarkus.amazon.lambda.runtime.QuarkusStreamHandler/QuarkusEventHandler); packaging that stripped the Quarkus bootstrap; JVM Lambda with a custom main that never ran the Quarkus app.

Related errors


AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05). Data as JSON: /api/errors/77daf77fb65f3bc7. Report an issue: GitHub.