quarkusio/quarkus · error · IllegalArgumentException
The Google Cloud extensions are incompatible with the 'nativ
Error message
The Google Cloud extensions are incompatible with the 'native-sources' package type.
What it means
During the Quarkus build, when the package type is 'native-sources', this build step intentionally aborts the build because the Google Cloud Functions extensions do not support that packaging mode. It throws IllegalArgumentException so the build fails fast instead of producing a deployable that will not work on GCF.
Source
Thrown at extensions/google-cloud-functions/deployment/src/main/java/io/quarkus/gcp/functions/deployment/CloudFunctionDeploymentBuildStep.java:22
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;
import io.quarkus.builder.BuildException;
import io.quarkus.deployment.IsProduction;
import io.quarkus.deployment.annotations.BuildProducer;
import io.quarkus.deployment.annotations.BuildStep;
import io.quarkus.deployment.pkg.builditem.ArtifactResultBuildItem;
import io.quarkus.deployment.pkg.builditem.JarBuildItem;
import io.quarkus.deployment.pkg.builditem.OutputTargetBuildItem;
import io.quarkus.deployment.pkg.steps.NativeBuild;
import io.quarkus.deployment.pkg.steps.NativeSourcesBuild;
public class CloudFunctionDeploymentBuildStep {
@BuildStep(onlyIf = NativeSourcesBuild.class)
void failForNativeSources(BuildProducer<ArtifactResultBuildItem> artifactResultProducer) {
throw new IllegalArgumentException(
"The Google Cloud extensions are incompatible with the 'native-sources' package type.");
}
/**
* Creates a target/deployment dir and copy the uber jar in it.
* This facilitates the usage of the 'gcloud' command.
*/
@BuildStep(onlyIf = IsProduction.class, onlyIfNot = NativeBuild.class)
public ArtifactResultBuildItem functionDeployment(OutputTargetBuildItem target, JarBuildItem jar)
throws BuildException, IOException {
if (!jar.isUberJar()) {
throw new BuildException("Google Cloud Function deployment need to use a uberjar, " +
"please set 'quarkus.package.jar.type=uber-jar' inside your application.properties",
List.of());
}
Path deployment = target.getOutputDirectory().resolve("deployment");
if (Files.notExists(deployment)) {View on GitHub (pinned to e1c734241f)
Solutions
- Remove quarkus.package.type=native-sources from your configuration.
- Use quarkus.package.type=native (build the native image in place) if you need a native GCF function.
- Use the default uber-jar packaging if deploying a JVM-based GCF function.
- Split the build: produce the uber-jar with GCF, or handle native compilation differently than native-sources.
Example fix
// before (application.properties) quarkus.package.type=native-sources // after quarkus.package.type=native
Defensive patterns
Strategy: validation
Validate before calling
// fail fast in your CI before building if [ "$(grep -E 'quarkus.package.type=native-sources' src/main/resources/application.properties)" ]; then echo "native-sources is unsupported for Google Cloud Functions"; exit 1; fi
Prevention
- Never set quarkus.package.type=native-sources in GCF projects
- Use quarkus.package.type=native for native GCF functions
- Review CI packaging overrides before enabling native-sources builds
- Pin GCF packaging config in application.properties and code-review changes
When it happens
Trigger: Building a Google Cloud Functions project with quarkus.package.type=native-sources (the package type used to compile native sources on a separate machine/container).
Common situations: CI pipelines that compile native images out-of-cluster using the native-sources output; users following generic native-sources guides with a GCF project.
Related errors
- Google Cloud Function deployment need to use a uberjar, plea
- Google Cloud Function deployment need to use a uberjar, plea
- Multiple GeneratedClassBuildItem were produced for the same
- No Google Cloud Function found on the classpath
- Failed to open path tree with root %s
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/395e69d309c2a9ba.
Report an issue: GitHub.