JetBrains/intellij-community · error · BuildException
Selected InputHandler should be used by Intellij IDEA
Error message
Selected InputHandler should be used by Intellij IDEA
What it means
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").
Source
Thrown at java/java-runtime/src/com/intellij/rt/ant/execution/IdeaInputHandler.java:21
import org.apache.tools.ant.BuildException;
import org.apache.tools.ant.input.InputHandler;
import org.apache.tools.ant.input.InputRequest;
import org.apache.tools.ant.input.MultipleChoiceInputRequest;
import java.io.IOException;
import java.util.List;
public class IdeaInputHandler implements InputHandler {
@Override
public void handleInput(InputRequest request) throws BuildException {
final String prompt = request.getPrompt();
if (prompt == null) {
throw new BuildException("Prompt is null");
}
final SegmentedOutputStream err = IdeaAntLogger2.ourErr;
if (err == null) {
throw new BuildException("Selected InputHandler should be used by Intellij IDEA");
}
final PacketWriter packet = PacketFactory.ourInstance.createPacket(AntLoggerConstants.INPUT_REQUEST);
packet.appendLimitedString(prompt);
packet.appendLimitedString(request.getDefaultValue());
if (request instanceof MultipleChoiceInputRequest) {
@SuppressWarnings("unchecked")
List<String> choices = ((MultipleChoiceInputRequest)request).getChoices();
if (choices != null && !choices.isEmpty()) {
int count = choices.size();
packet.appendLong(count);
for (String choice : choices) {
packet.appendLimitedString(choice);
}
}
else {
packet.appendLong(0);
}
}View on GitHub (pinned to be881553f2)
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.
Example fix
# before ant -inputhandler com.intellij.rt.ant.execution.IdeaInputHandler build # outside IDEA -> throws # after ant build # default input handler works standalone
Defensive patterns
Strategy: fallback
Validate before calling
# only use the handler inside IDEA-launched builds: ant build # drop -inputhandler ...IdeaInputHandler when standalone
Prevention
- 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.
When it happens
Trigger: 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).
Common situations: 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.
Related errors
- \nThe version of the executed Ant is not compatible with the
- Prompt is null
- Invalid input: {input}
- Row index: %d. Error during nested table row creation: row i
- Column number: %d. Error during retrieving value from nested
AI-assisted analysis of JetBrains/intellij-community@be881553f2 (2026-08-14).
Data as JSON: /api/errors/a6c1609b5ea7f46d.
Report an issue: GitHub.