{"record":{"id":"a6c1609b5ea7f46d","repo":"JetBrains/intellij-community","slug":"selected-inputhandler-should-be-used-by-intellij-i","errorCode":null,"errorMessage":"Selected InputHandler should be used by Intellij IDEA","messagePattern":"Selected InputHandler should be used by Intellij IDEA","errorType":"exception","errorClass":"BuildException","httpStatus":null,"severity":"error","filePath":"java/java-runtime/src/com/intellij/rt/ant/execution/IdeaInputHandler.java","lineNumber":21,"sourceCode":"\nimport org.apache.tools.ant.BuildException;\nimport org.apache.tools.ant.input.InputHandler;\nimport org.apache.tools.ant.input.InputRequest;\nimport org.apache.tools.ant.input.MultipleChoiceInputRequest;\n\nimport java.io.IOException;\nimport java.util.List;\n\npublic class IdeaInputHandler implements InputHandler {\n  @Override\n  public void handleInput(InputRequest request) throws BuildException {\n    final String prompt = request.getPrompt();\n    if (prompt == null) {\n      throw new BuildException(\"Prompt is null\");\n    }\n    final SegmentedOutputStream err = IdeaAntLogger2.ourErr;\n    if (err == null) {\n      throw new BuildException(\"Selected InputHandler should be used by Intellij IDEA\");\n    }\n    final PacketWriter packet = PacketFactory.ourInstance.createPacket(AntLoggerConstants.INPUT_REQUEST);\n    packet.appendLimitedString(prompt);\n    packet.appendLimitedString(request.getDefaultValue());\n    if (request instanceof MultipleChoiceInputRequest) {\n      @SuppressWarnings(\"unchecked\") \n      List<String> choices = ((MultipleChoiceInputRequest)request).getChoices();\n      if (choices != null && !choices.isEmpty()) {\n        int count = choices.size();\n        packet.appendLong(count);\n        for (String choice : choices) {\n          packet.appendLimitedString(choice);\n        }\n      }\n      else {\n        packet.appendLong(0);\n      }\n    }","sourceCodeStart":3,"sourceCodeEnd":39,"githubUrl":"https://github.com/JetBrains/intellij-community/blob/be881553f2a76ac8b4ea53950d93f0de78295c19/java/java-runtime/src/com/intellij/rt/ant/execution/IdeaInputHandler.java#L3-L39","documentation":"IdeaInputHandler communicates with the IDE through IdeaAntLogger2.ourErr, a SegmentedOutputStream that IDEA installs when it launches Ant. If that static field is null, the handler is running outside an IDEA-spawned build process (no logger initialized), so it throws BuildException(\"Selected InputHandler should be used by Intellij IDEA\").","triggerScenarios":"Manually running Ant with -inputhandler com.intellij.rt.ant.execution.IdeaInputHandler from a plain command line, or a build process where IdeaAntLogger2 was never initialized (IDE launched Ant through a different path).","commonSituations":"Copying the IDEA-generated Ant command line to a terminal/CI; scripts that reuse IDEA's Ant runtime jars; running the same build.xml under a standalone Ant distribution while keeping IDEA-specific handler settings.","solutions":["Remove the -inputhandler IdeaInputHandler flag (and related IDEA Ant runtime classpath entries) when running Ant outside IntelliJ.","Run the build from the IDEA Ant tool window so the IDE initializes IdeaAntLogger2 before any <input> task.","In CI, use the DefaultInputHandler or a property-file driven input handler instead of the IDE one."],"exampleFix":"# before\nant -inputhandler com.intellij.rt.ant.execution.IdeaInputHandler build # outside IDEA -> throws\n\n# after\nant build # default input handler works standalone","handlingStrategy":"fallback","validationCode":"# only use the handler inside IDEA-launched builds:\nant build # drop -inputhandler ...IdeaInputHandler when standalone","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Strip IDEA-specific -inputhandler flags from command lines reused outside the IDE.","Run builds needing <input> from the IDEA Ant tool window.","Use DefaultInputHandler in CI."],"tags":["ant","intellij","input-handler","environment","build-tools"],"backgroundTag":null,"analyzedSha":"be881553f2a76ac8b4ea53950d93f0de78295c19","analyzedAt":"2026-08-14T14:13:06.425Z","schemaVersion":2},"datasetVersion":"2026-08-15T22:17:37.221Z"}