{"record":{"id":"a15e7823848e1001","repo":"quarkusio/quarkus","slug":"failed-to-add-extensions-getextensionstoadd","errorCode":null,"errorMessage":"Failed to add extensions + getExtensionsToAdd()","messagePattern":"Failed to add extensions \\+ getExtensionsToAdd\\(\\)","errorType":"exception","errorClass":"GradleException","httpStatus":null,"severity":"error","filePath":"devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusAddExtension.java","lineNumber":49,"sourceCode":"    @Input\n    public List<String> getExtensionsToAdd() {\n        return extensionsToAdd;\n    }\n\n    @TaskAction\n    public void addExtension() {\n        Set<String> extensionsSet = getExtensionsToAdd()\n                .stream()\n                .flatMap(ext -> stream(ext.split(\",\")))\n                .map(String::trim)\n                .collect(toSet());\n\n        try {\n            AddExtensions addExtensions = new AddExtensions(getQuarkusProject(false))\n                    .extensions(extensionsSet);\n            addExtensions.execute();\n        } catch (Exception e) {\n            throw new GradleException(\"Failed to add extensions \" + getExtensionsToAdd(), e);\n        }\n    }\n}\n","sourceCodeStart":31,"sourceCodeEnd":53,"githubUrl":"https://github.com/quarkusio/quarkus/blob/e1c734241f34c7919086ceb4c9262b4a58f6de44/devtools/gradle/gradle-application-plugin/src/main/java/io/quarkus/gradle/tasks/QuarkusAddExtension.java#L31-L53","documentation":"Thrown by QuarkusAddExtension.addExtension() as a wrapper when executing the AddExtensions command (which modifies the build file to add extension dependencies) fails for any reason. The original exception is attached as the cause; the message includes the extensions that were requested.","triggerScenarios":"Running gradle addExtension --extensions=... when the build script cannot be parsed/modified (unsupported build script format, version catalog or unusual dependency syntax, read-only files, or an invalid extension coordinates string).","commonSituations":"Using addExtension in projects with build.gradle.kts constructs the tool cannot rewrite; offline/invalid artifact coordinates causing resolution failure; permission problems on build files in CI containers.","solutions":["Inspect the 'Caused by' in the stack trace to see the underlying failure","Add the dependency manually in build.gradle(.kts), e.g. implementation(\"io.quarkus:quarkus-cache\")","Verify the extension name/coordinates are valid (use the Quarkus registry) and that build files are writable"],"exampleFix":"// before: gradle addExtension --extensions=quarkus-not-a-real-ext  -> GradleException\n// after: add manually in build.gradle\ndependencies { implementation(\"io.quarkus:quarkus-cache\") }","handlingStrategy":"try-catch","validationCode":"// ensure extension name is valid before running the task\nif (!extName.matches(Regex(\"quarkus-[a-z0-9-]+\")))\n  throw IllegalArgumentException(\"Invalid extension id: $extName\")","typeGuard":null,"tryCatchPattern":"task 'addExtension' fails with GradleException('Failed to add extensions ...'):\n// read e.cause (or the 'Caused by:' block) to decide between\n// manual dependency add vs fixing file permissions/coordinates","preventionTips":["Check the 'Caused by' root cause before retrying","Keep build scripts in a format the tool can rewrite (standard dependencies block)","Ensure build files are writable in CI containers"],"tags":["gradle","dependency-management","extension-management"],"backgroundTag":"build-script-modification-failed","analyzedSha":"e1c734241f34c7919086ceb4c9262b4a58f6de44","analyzedAt":"2026-09-05T17:01:29.979Z","contentChangedAt":"2026-09-05T17:01:29.979Z","schemaVersion":2},"datasetVersion":"2026-09-12T22:17:10.623Z"}