palantir / palantir/palantir-java-format

java.io.UncheckedIOException: Error running formatter command

Open
#1,415 0 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Java
Stars
908
Forks
101
Avg merge
1d 3h
Merged PRs (30d)
19

Description

With version 2.74.0.

java.io.UncheckedIOException: Error running formatter command
	at com.palantir.javaformat.bootstrap.BootstrappingFormatterService.getFormatReplacements(BootstrappingFormatterService.java:59)
	at com.palantir.javaformat.intellij.PalantirJavaFormatFormattingService$PalantirJavaFormatFormattingTask.run(PalantirJavaFormatFormattingService.java:105)
	at com.intellij.formatting.service.AsyncDocumentFormattingService$FormattingRequestImpl.runTask(AsyncDocumentFormattingService.java:261)
	at com.intellij.formatting.service.AsyncDocumentFormattingService.runAsyncFormat(AsyncDocumentFormattingService.java:106)
	at com.intellij.formatting.service.AsyncDocumentFormattingService$FormattingProgressTask.run(AsyncDocumentFormattingService.java:380)
	at com.intellij.openapi.progress.impl.CoreProgressManager.startTask(CoreProgressManager.java:498)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.startTask(ProgressManagerImpl.java:119)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcessWithProgressAsynchronously$7(CoreProgressManager.java:549)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$4(ProgressRunner.java:252)
	at com.intellij.openapi.progress.ProgressManager.lambda$runProcess$0(ProgressManager.java:98)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:229)
	at com.intellij.platform.diagnostic.telemetry.helpers.TraceKt.use(trace.kt:44)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$2(CoreProgressManager.java:228)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$executeProcessUnderProgress$14(CoreProgressManager.java:681)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:756)
	at com.intellij.openapi.progress.impl.CoreProgressManager.computeUnderProgress(CoreProgressManager.java:712)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:680)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:78)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:209)
	at com.intellij.openapi.progress.ProgressManager.runProcess(ProgressManager.java:98)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$submit$5(ProgressRunner.java:252)
	at com.intellij.openapi.progress.impl.ProgressRunner$ProgressRunnable.run(ProgressRunner.java:515)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$launchTask$18(ProgressRunner.java:480)
	at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:167)
	at com.intellij.util.concurrency.ChildContext$runInChildContext$1.invoke(propagation.kt:167)
	at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:173)
	at com.intellij.util.concurrency.ChildContext.runInChildContext(propagation.kt:167)
	at com.intellij.openapi.progress.impl.ProgressRunner.lambda$launchTask$19(ProgressRunner.java:476)
	at java.base/java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1144)
	at java.base/java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:642)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:735)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1$1.run(Executors.java:732)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:400)
	at java.base/java.util.concurrent.Executors$PrivilegedThreadFactory$1.run(Executors.java:732)
	at java.base/java.lang.Thread.run(Thread.java:1583)
Caused by: java.io.IOException: Command terminated with exit value 1
Command: /Library/Java/JavaVirtualMachines/openjdk-21.jdk/Contents/Home/bin/java --add-exports jdk.compiler/com.sun.tools.javac.api=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.file=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.parser=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.tree=ALL-UNNAMED --add-exports jdk.compiler/com.sun.tools.javac.util=ALL-UNNAMED -cp /Users/johan/Library/Application Support/JetBrains/IntelliJIdea2025.2/plugins/palantir-java-format/impl/jackson-module-parameter-names-2.19.2.jar:/Users/johan/Library/Application Support/JetBrains/IntelliJIdea2025.2/plugins/palantir-java-format/impl/jackson-datatype-jdk8-2.19.2.jar:/Users/johan/Library/Application Support/JetBrains/IntelliJIdea2025.2/plugins/palantir-java-format/impl/jspecify-1.0.0.jar:/Users/johan/Library/Application Support/JetBrains/IntelliJIdea2025.2/plugins/palantir-java-format/impl/jackson-databind-2.19.2.jar:/Users/johan/Library/Application Support/JetBrains/IntelliJIdea2025.2/plugins/palantir-java-format/impl/jackson-annotations-2.19.2.jar:/Users/johan/Library/Application Support/JetBrains/IntelliJIdea2025.2/plugins/palantir-java-format/impl/failureaccess-1.0.3.jar:/Users/johan/Library/Application Support/JetBrains/IntelliJIdea2025.2/plugins/palantir-java-format/impl/error_prone_annotations-2.36.0.jar:/Users/johan/Library/Application Support/JetBrains/IntelliJIdea2025.2/plugins/palantir-java-format/impl/listenablefuture-9999.0-empty-to-avoid-conflict-with-guava.jar:/Users/johan/Library/Application Support/JetBrains/IntelliJIdea2025.2/plugins/palantir-java-format/impl/palantir-java-format-spi-2.74.0.jar:/Users/johan/Library/Application Support/JetBrains/IntelliJIdea2025.2/plugins/palantir-java-format/impl/guava-33.4.8-jre.jar:/Users/johan/Library/Application Support/JetBrains/IntelliJIdea2025.2/plugins/palantir-java-format/impl/j2objc-annotations-3.0.0.jar:/Users/johan/Library/Application Support/JetBrains/IntelliJIdea2025.2/plugins/palantir-java-format/impl/functionaljava-4.8.jar:/Users/johan/Library/Application Support/JetBrains/IntelliJIdea2025.2/plugins/palantir-java-format/impl/jackson-core-2.19.2.jar:/Users/johan/Library/Application Support/JetBrains/IntelliJIdea2025.2/plugins/palantir-java-format/impl/palantir-java-format-2.74.0.jar:/Users/johan/Library/Application Support/JetBrains/IntelliJIdea2025.2/plugins/palantir-java-format/impl/jackson-datatype-guava-2.19.2.jar:/Users/johan/Library/Application Support/JetBrains/IntelliJIdea2025.2/plugins/palantir-java-format/impl/jsr305-3.0.2.jar com.palantir.javaformat.java.Main --character-ranges 3832:3840 --output-replacements --palantir -
Working Directory: /Library/Java/JavaVirtualMachines/openjdk-21.jdk/Contents/Home/bin
Stdout:

Stderr:
<stdin>:error: error: invalid length 9, offset + length (3840) is outside the file

	at com.palantir.javaformat.bootstrap.FormatterCommandRunner.runWithStdin(FormatterCommandRunner.java:59)
	at com.palantir.javaformat.bootstrap.BootstrappingFormatterService.getFormatReplacementsInternal(BootstrappingFormatterService.java:93)
	at com.palantir.javaformat.bootstrap.BootstrappingFormatterService.getFormatReplacements(BootstrappingFormatterService.java:57)
	... 34 more

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the formatter failure with the reported character range, then read BootstrappingFormatterService.getFormatReplacements and FormatterCommandRunner.runWithStdin. Trace how the range 3832:3840 is passed to the formatter and establish the expected behavior when it exceeds the input length; done means the command no longer fails unexpectedly and the behavior is covered by a regression test.

Written by the indexing model from the issue text.

Assessment

Tech stack
java
Domain
tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.