quarkusio/quarkus · info · IllegalArgumentException

Can only greet nicknames

Error message

Can only greet nicknames

What it means

ProcessingService.process() is a Lambda handler used by the amazon-lambda integration test to exercise error propagation: it throws IllegalArgumentException(CAN_ONLY_GREET_NICKNAMES) when the input's name is exactly "Stuart". Any other name produces greeting + name. This is a deliberate sentinel error proving exceptions in Lambda handlers surface as invocation errors.

Source

Thrown at integration-tests/amazon-lambda/src/main/java/io/quarkus/it/amazon/lambda/ProcessingService.java:12

package io.quarkus.it.amazon.lambda;

import jakarta.enterprise.context.ApplicationScoped;

@ApplicationScoped
public class ProcessingService {

    public static final String CAN_ONLY_GREET_NICKNAMES = "Can only greet nicknames";

    public OutputObject process(InputObject input) {
        if (input.getName().equals("Stuart")) {
            throw new IllegalArgumentException(CAN_ONLY_GREET_NICKNAMES);
        }
        String result = input.getGreeting() + " " + input.getName();
        OutputObject out = new OutputObject();
        out.setResult(result);
        return out;
    }
}

View on GitHub (pinned to e1c734241f)

Solutions

  1. Use an InputObject with a name other than "Stuart" (e.g. "Alice") to get a successful result
  2. If testing errors, keep "Stuart" and assert on the IllegalArgumentException / Lambda error response
  3. If this appears unexpectedly, check the request payload's name field for the sentinel value

Example fix

// before
{"name":"Stuart"}   // throws IllegalArgumentException
// after
{"name":"Alice"}    // returns {"result":"Hello Alice"} (per configured greeting)
Defensive patterns

Strategy: validation

Validate before calling

if ("Stuart".equals(input.getName())) {
    // this invocation will throw IllegalArgumentException by design
}

Try / catch

try {
    OutputObject out = service.process(input);
} catch (IllegalArgumentException e) {
    if (ProcessingService.CAN_ONLY_GREET_NICKNAMES.equals(e.getMessage())) {
        // known sentinel error, handle gracefully
    } else {
        throw e;
    }
}

Prevention

When it happens

Trigger: Invoking the Lambda (directly or via API/HTTP test clients) with an InputObject whose name field equals "Stuart"; the handler immediately throws before building the OutputObject.

Common situations: Running the amazon-lambda integration tests; manually testing Lambda error responses with sample events that use name "Stuart"; copying the sample test event JSON that intentionally triggers the failure.

Related errors


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