quarkusio/quarkus · error · IllegalArgumentException

The Amazon Lambda extensions are incompatible with the 'nati

Error message

The Amazon Lambda extensions are incompatible with the 'native-sources' package type.

What it means

This build step aborts the Quarkus build when the package type is native-sources because Amazon Lambda extensions cannot produce a deployable artifact from native sources (they expect either a JVM zip deployment or a full native binary).

Source

Thrown at extensions/amazon-lambda/common-deployment/src/main/java/io/quarkus/amazon/lambda/deployment/AmazonLambdaCommonProcessor.java:32

import io.quarkus.deployment.builditem.SnapStartDefaultValueBuildItem;
import io.quarkus.deployment.builditem.SystemPropertyBuildItem;
import io.quarkus.deployment.builditem.nativeimage.ReflectiveClassBuildItem;
import io.quarkus.deployment.pkg.builditem.ArtifactResultBuildItem;
import io.quarkus.deployment.pkg.steps.NativeBuild;
import io.quarkus.deployment.pkg.steps.NativeSourcesBuild;
import io.quarkus.jackson.runtime.JsonMapperProducer;
import io.quarkus.runtime.LaunchMode;
import tools.jackson.databind.ObjectMapper;

public final class AmazonLambdaCommonProcessor {
    @BuildStep
    public SnapStartDefaultValueBuildItem enableSnapStartByDefault() {
        return new SnapStartDefaultValueBuildItem(true);
    }

    @BuildStep(onlyIf = NativeSourcesBuild.class)
    void failForNativeSources(BuildProducer<ArtifactResultBuildItem> artifactResultProducer) {
        throw new IllegalArgumentException(
                "The Amazon Lambda extensions are incompatible with the 'native-sources' package type.");
    }

    @BuildStep
    void tmpdirs(BuildProducer<SystemPropertyBuildItem> systemProperty,
            LaunchModeBuildItem launchModeBuildItem) {
        LaunchMode mode = launchModeBuildItem.getLaunchMode();
        if (mode.isDevOrTest()) {
            return; // just in case we're on Windows.
        }
        systemProperty.produce(new SystemPropertyBuildItem("java.io.tmpdir", "/tmp"));
        systemProperty.produce(new SystemPropertyBuildItem("vertx.cacheDirBase", "/tmp/vertx"));
    }

    @BuildStep
    public void markObjectMapper(BuildProducer<UnremovableBeanBuildItem> unremovable) {
        unremovable.produce(new UnremovableBeanBuildItem(
                new UnremovableBeanBuildItem.BeanClassNameExclusion(ObjectMapper.class.getName())));

View on GitHub (pinned to e1c734241f)

Solutions

  1. Remove the Amazon Lambda extension if you truly need native-sources packaging
  2. Change package type to native: -Dquarkus.package.type=native
  3. Use the default jar/zip package type and deploy via the Lambda JVM runtime
  4. If using native-sources with a custom container build, drop Lambda extensions and implement the function outside Quarkus Amazon Lambda tooling

Example fix

// before
mvn package -Dquarkus.package.type=native-sources
// after
mvn package -Dquarkus.package.type=native
Defensive patterns

Strategy: validation

Prevention

When it happens

Trigger: Building with -Dquarkus.package.type=native-sources (NativeSourcesBuild condition) while any Amazon Lambda extension is on the classpath; the failForNativeSources build step runs unconditionally under that condition.

Common situations: Using container-based native source builds (e.g. for custom runtimes) in a Lambda project; CI pipelines copying docker-native/native-sources settings from another service onto a Lambda function build.

Related errors


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