Anuken/Mindustry · error · IllegalArgumentException

----\n\nSET A BUILD NUMBER FIRST!\n\n----

Error message

----\n\nSET A BUILD NUMBER FIRST!\n\n----

What it means

Thrown by the deployAll task's cleanDeployOutput doFirst block when getBuildVersion() returns 'custom build' or an empty string. getBuildVersion (build.gradle:89-92) returns 'custom build' whenever the -Pbuildversion gradle property is absent, so the guard ensures no unversioned build is shipped. The very next line also requires the -Prelease property.

Source

Thrown at build.gradle:510

configure([":core", ":server"].collect{project(it)}){
    java{
        withJavadocJar()
        withSourcesJar()
    }

    publishing{
        publications{
            maven(MavenPublication){
                from components.java
            }
        }
    }
}

task deployAll{
    task cleanDeployOutput{
        doFirst{
            if(getBuildVersion() == "custom build" || getBuildVersion() == "") throw new IllegalArgumentException("----\n\nSET A BUILD NUMBER FIRST!\n\n----")
            if(!project.hasProperty("release")) throw new IllegalArgumentException("----\n\nSET THE RELEASE PROJECT PROPERTY FIRST!\n\n----")

            delete{
                delete "deploy/"
            }
        }
    }

    dependsOn cleanDeployOutput
    dependsOn "desktop:packrLinux64"
    dependsOn "desktop:packrWindows64"
    dependsOn "desktop:packrMacOS"
    if(versionModifier != "steam"){
        dependsOn "server:deploy"
        dependsOn "android:deploy"
    }
}

View on GitHub (pinned to f695ad7e60)

Solutions

  1. Pass the build version explicitly: gradle deployAll -Pbuildversion=146 -Prelease.
  2. In CI, fail the job early if the buildversion property is missing rather than letting deployAll throw.
  3. Cross-check that the same job also sets -Prelease, since the next guard will throw otherwise.
  4. Document the required properties in the release runbook next to the deploy command.

Example fix

// before
gradle deployAll

// after
gradle deployAll -Pbuildversion=146 -Prelease
Defensive patterns

Strategy: validation

Validate before calling

// Before running deployAll, assert the required gradle properties
if(!project.hasProperty("buildversion") || project.property("buildversion") in [null, "", "custom build"]){
    throw new GradleException("Pass -Pbuildversion=<number>");
}
if(!project.hasProperty("release")){
    throw new GradleException("Pass -Prelease");
}

Type guard

static boolean releaseReady(Project p){
    return p.hasProperty("buildversion") && p.property("buildversion") && p.hasProperty("release");
}

Prevention

When it happens

Trigger: Running 'gradle deployAll' (or any task that depends on it) without passing -Pbuildversion=<number>. Also fires if the property is present but set to an empty string.

Common situations: CI forgot to inject the build version property; a developer ran deployAll locally without release flags; a release script regressed and stopped passing -Pbuildversion; the property name was typo'd in the pipeline.

Related errors


AI-assisted analysis of Anuken/Mindustry@f695ad7e60 (2026-08-14). Data as JSON: /api/errors/51ef5e303d98ac3e. Report an issue: GitHub.