{"record":{"id":"bfd6904753f9e5fe","repo":"elastic/elasticsearch","slug":"tests-bwc-git-fetch-latest-must-be-true-or-fals","errorCode":null,"errorMessage":"tests.bwc.git_fetch_latest must be [true] or [false] but was [${fetchProp}]","messagePattern":"tests\\.bwc\\.git_fetch_latest must be \\[true\\] or \\[false\\] but was \\[(.+?)\\]","errorType":"validation","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/InternalBwcGitPlugin.java","lineNumber":123,"sourceCode":"                        // for testing only we can override the base remote url\n                        String remoteRepoUrl = providerFactory.systemProperty(\"testRemoteRepo\")\n                            .getOrElse(\"https://github.com/\" + remoteRepo + \"/\" + rootProjectName);\n                        spec.commandLine(\"git\", \"remote\", \"add\", remoteRepo, remoteRepoUrl);\n                    });\n                }\n            });\n        });\n\n        boolean isOffline = project.getGradle().getStartParameter().isOffline();\n        TaskProvider<LoggedExec> fetchLatestTaskProvider = tasks.register(\"fetchLatest\", LoggedExec.class, fetchLatest -> {\n            var gitFetchLatest = providerFactory.systemProperty(\"tests.bwc.git_fetch_latest\").orElse(\"true\").map(fetchProp -> {\n                if (\"true\".equals(fetchProp)) {\n                    return true;\n                }\n                if (\"false\".equals(fetchProp)) {\n                    return false;\n                }\n                throw new GradleException(\"tests.bwc.git_fetch_latest must be [true] or [false] but was [\" + fetchProp + \"]\");\n            });\n            fetchLatest.onlyIf(\"DRA snapshot not available\", task -> draBuildId.get().isEmpty());\n            fetchLatest.onlyIf(\"online and gitFetchLatest == true\", t -> isOffline == false && gitFetchLatest.get());\n            fetchLatest.dependsOn(addRemoteTaskProvider);\n            fetchLatest.getWorkingDir().set(gitExtension.getCheckoutDir());\n            // Fetch latest from remotes, including tags, overriding any existing local refs\n            fetchLatest.commandLine(\"git\", \"fetch\", \"--all\", \"--tags\", \"--force\");\n        });\n\n        String projectPath = project.getPath();\n        TaskProvider<Task> checkoutBwcBranchTaskProvider = tasks.register(\"checkoutBwcBranch\", checkoutBwcBranch -> {\n            checkoutBwcBranch.dependsOn(fetchLatestTaskProvider);\n            checkoutBwcBranch.onlyIf(\"DRA snapshot not available\", task -> draBuildId.get().isEmpty());\n            ExtraPropertiesExtension taskExtensionsProperties = checkoutBwcBranch.getExtensions().getExtraProperties();\n            checkoutBwcBranch.doLast(new Action<Task>() {\n                @Override\n                public void execute(Task task) {\n                    File checkoutDir = gitExtension.getCheckoutDir().get();","sourceCodeStart":105,"sourceCodeEnd":141,"githubUrl":"https://github.com/elastic/elasticsearch/blob/db6a809a667c081ca1dc7500389d26975573215f/build-tools-internal/src/main/java/org/elasticsearch/gradle/internal/InternalBwcGitPlugin.java#L105-L141","documentation":"Thrown as GradleException inside the fetchLatest task configuration when the system property tests.bwc.git_fetch_latest is set to a value other than \"true\" or \"false\". The property controls whether the BWC git checkout fetches latest from remotes; the provider maps the string to a boolean and rejects anything ambiguous rather than silently defaulting.","triggerScenarios":"At line 116 the providerFactory resolves tests.bwc.git_fetch_latest (defaulting to \"true\") and runs a map that checks for exactly \"true\" or \"false\". Passing -Dtests.bwc.git_fetch_latest=yes, =1, =TRUE (case-sensitive), or an empty trailing value triggers the throw at line 123.","commonSituations":"Developer passes -Dtests.bwc.git_fetch_latest=1 or =yes expecting truthiness; CI script sets the property from an unquoted shell variable that resolves to empty; copy-paste of a property name with a trailing space; case mismatch (TRUE vs true).","solutions":["Set the property to exactly true or false (lowercase): -Dtests.bwc.git_fetch_latest=false.","Omit the property entirely to accept the default (true).","Check the CI/shell script for unquoted variables or trailing whitespace that corrupts the value."],"exampleFix":"# before\n./gradlew bwcTest -Dtests.bwc.git_fetch_latest=1\n\n# after\n./gradlew bwcTest -Dtests.bwc.git_fetch_latest=false","handlingStrategy":"validation","validationCode":"String v = System.getProperty(\"tests.bwc.git_fetch_latest\", \"true\");\nif (\"true\".equalsIgnoreCase(v) == false && \"false\".equalsIgnoreCase(v) == false) {\n    throw new IllegalArgumentException(\"Invalid value for tests.bwc.git_fetch_latest: \" + v);\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always use lowercase 'true' or 'false' for tests.bwc.git_fetch_latest.","Quote shell variables when passing system properties in CI scripts.","Omit the property to accept the default (true) when in doubt.","Validate property values in a pre-check script before invoking Gradle."],"tags":["bwc","gradle","system-property","validation"],"backgroundTag":null,"analyzedSha":"db6a809a667c081ca1dc7500389d26975573215f","analyzedAt":"2026-08-12T01:39:14.192Z","schemaVersion":2},"datasetVersion":"2026-08-13T09:17:06.757Z"}