quarkusio/quarkus · error · BuildException
The app name '%s' is not valid. The <appName> only allow alp
Error message
The app name '%s' is not valid. The <appName> only allow alphanumeric characters, hyphens and cannot start or end in a hyphen.
What it means
Azure function app names must match Azure's naming rules: alphanumeric characters and hyphens only, must not start or end with a hyphen (checked via APP_NAME_PATTERN). validateParameters throws BuildException with INVALID_APP_NAME when the configured name fails this regex or starts with '-'.
Source
Thrown at extensions/azure-functions/deployment/src/main/java/io/quarkus/azure/functions/deployment/AzureFunctionsDeployCommand.java:171
@Override
public AzureString getDescription() {
return AzureString.fromString("Quarkus");
}
};
OperationThreadContext ctx = OperationThreadContext.current();
push.invoke(ctx, dummy);
} catch (Exception e) {
}
}
protected void validateParameters(AzureFunctionsConfig config, String appName) throws BuildException {
// app name
if (StringUtils.isBlank(appName)) {
throw new BuildException(EMPTY_APP_NAME);
}
if (appName.startsWith("-") || !appName.matches(APP_NAME_PATTERN)) {
throw new BuildException(format(INVALID_APP_NAME, appName));
}
// resource group
if (StringUtils.isBlank(config.resourceGroup())) {
throw new BuildException(EMPTY_RESOURCE_GROUP);
}
if (config.resourceGroup().endsWith(".") || !config.resourceGroup().matches(RESOURCE_GROUP_PATTERN)) {
throw new BuildException(INVALID_RESOURCE_GROUP_NAME);
}
// asp name & resource group
if (StringUtils.isNotEmpty(config.appServicePlanName())
&& !config.appServicePlanName().matches(APP_SERVICE_PLAN_NAME_PATTERN)) {
throw new BuildException(format(INVALID_SERVICE_PLAN_NAME, APP_SERVICE_PLAN_NAME_PATTERN));
}
if (config.appServicePlanResourceGroup().isPresent()
&& StringUtils.isNotEmpty(config.appServicePlanResourceGroup().orElse(null))
&&
(config.appServicePlanResourceGroup().orElse(null).endsWith(".")
|| !config.appServicePlanResourceGroup().orElse(null).matches(RESOURCE_GROUP_PATTERN))) {View on GitHub (pinned to e1c734241f)
Solutions
- Rename the appName to lowercase alphanumerics with interior hyphens only (e.g. my-quarkus-func)
- Strip leading/trailing hyphens and replace underscores/dots with hyphens
- Keep artifactId and appName separate if the artifactId doesn't satisfy the pattern
Example fix
<!-- before --> <appName>my_quarkus_func</appName> <!-- after --> <appName>my-quarkus-func</appName>
Defensive patterns
Strategy: validation
Validate before calling
private static final Pattern APP_NAME = Pattern.compile("^[a-zA-Z0-9][a-zA-Z0-9-]*[a-zA-Z0-9]$|^[a-zA-Z0-9]$");
if (!APP_NAME.matcher(appName).matches() || appName.startsWith("-")) {
throw new IllegalArgumentException("Invalid Azure function app name: " + appName);
} Type guard
static boolean isValidAzureAppName(String name) {
return name != null && !name.startsWith("-")
&& name.matches("[a-zA-Z0-9-]+")
&& !name.endsWith("-");
} Prevention
- Sanitize artifactId-derived names: replace [_\\s.] with '-'
- Trim and strip leading/trailing hyphens from configured names
- Validate appName in CI before running deploy
When it happens
Trigger: quarkus:deploy with an appName containing underscores, spaces, dots, uppercase invalid per pattern, or leading/trailing hyphens (e.g. my_app, -myapp-, my.app).
Common situations: Using the Maven artifactId or project name verbatim as appName when it contains underscores or dots; trailing whitespace or hyphen from templated values; copy-paste from Azure portal showing a display name.
Related errors
- Invalid global variable name found: %s - supplied by %s -
- ${name} is not a valid class name
- ${name} is not a valid package name
- Extra steps left over
- Unknown start character for json value: %s
AI-assisted analysis of quarkusio/quarkus@e1c734241f (2026-09-05).
Data as JSON: /api/errors/4645757e6598aeae.
Report an issue: GitHub.