Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repeated ExecutionException when file doesn't exist #72

Closed
nomaed opened this issue Nov 20, 2018 · 3 comments
Closed

Repeated ExecutionException when file doesn't exist #72

nomaed opened this issue Nov 20, 2018 · 3 comments

Comments

@nomaed
Copy link

nomaed commented Nov 20, 2018

If an env-file does not exist, IntelliJ repeatedly throws a scary looking error due to plugin exception:

com.intellij.execution.ExecutionException: EnvFile: invalid path - environment.json
	at net.ashald.envfile.platform.ui.EnvFileConfigurationEditor.validateConfiguration(EnvFileConfigurationEditor.java:151)
	at net.ashald.envfile.products.idea.IdeaRunConfigurationExtension.validateConfiguration(IdeaRunConfigurationExtension.java:51)
	at com.intellij.execution.configuration.RunConfigurationExtensionsManager.validateConfiguration(RunConfigurationExtensionsManager.java:127)
	at com.intellij.execution.JavaRunConfigurationExtensionManager.checkConfigurationIsValid(JavaRunConfigurationExtensionManager.java:37)
	at com.intellij.spring.boot.run.SpringBootApplicationRunConfiguration.checkConfiguration(SpringBootApplicationRunConfiguration.java:98)
	at com.intellij.execution.impl.RunnerAndConfigurationSettingsImpl.checkSettings(RunnerAndConfigurationSettingsImpl.kt:321)
	at com.intellij.execution.RunnerAndConfigurationSettings.checkSettings(RunnerAndConfigurationSettings.java:116)
	at com.intellij.execution.impl.TimedIconCache.calcIcon(TimedIconCache.kt:66)
	at com.intellij.execution.impl.TimedIconCache.access$calcIcon(TimedIconCache.kt:18)
	at com.intellij.execution.impl.TimedIconCache$get$$inlined$write$lambda$1.fun(TimedIconCache.kt:50)
	at com.intellij.execution.impl.TimedIconCache$get$$inlined$write$lambda$1.fun(TimedIconCache.kt:18)
	at com.intellij.ui.DeferredIconImpl.evaluate(DeferredIconImpl.java:282)
	at com.intellij.ui.DeferredIconImpl.lambda$null$0(DeferredIconImpl.java:167)
	at com.intellij.ui.IconDeferrerImpl.evaluateDeferred(IconDeferrerImpl.java:114)
	at com.intellij.ui.DeferredIconImpl.lambda$null$1(DeferredIconImpl.java:167)
	at com.intellij.openapi.application.impl.ApplicationImpl.tryRunReadAction(ApplicationImpl.java:1161)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runInReadActionWithWriteActionPriority$0(ProgressIndicatorUtils.java:70)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.lambda$runWithWriteActionPriority$1(ProgressIndicatorUtils.java:123)
	at com.intellij.openapi.progress.impl.CoreProgressManager.lambda$runProcess$1(CoreProgressManager.java:157)
	at com.intellij.openapi.progress.impl.CoreProgressManager.registerIndicatorAndRun(CoreProgressManager.java:580)
	at com.intellij.openapi.progress.impl.CoreProgressManager.executeProcessUnderProgress(CoreProgressManager.java:525)
	at com.intellij.openapi.progress.impl.ProgressManagerImpl.executeProcessUnderProgress(ProgressManagerImpl.java:85)
	at com.intellij.openapi.progress.impl.CoreProgressManager.runProcess(CoreProgressManager.java:144)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runWithWriteActionPriority(ProgressIndicatorUtils.java:112)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:70)
	at com.intellij.openapi.progress.util.ProgressIndicatorUtils.runInReadActionWithWriteActionPriority(ProgressIndicatorUtils.java:91)
	at com.intellij.ui.DeferredIconImpl.lambda$paintIcon$4(DeferredIconImpl.java:166)
	at com.intellij.util.concurrency.BoundedTaskExecutor.doRun(BoundedTaskExecutor.java:226)
	at com.intellij.util.concurrency.BoundedTaskExecutor.access$100(BoundedTaskExecutor.java:26)
	at com.intellij.util.concurrency.BoundedTaskExecutor$2$1.run(BoundedTaskExecutor.java:199)
	at com.intellij.util.ConcurrencyUtil.runUnderThreadName(ConcurrencyUtil.java:229)
	at com.intellij.util.concurrency.BoundedTaskExecutor$2.run(BoundedTaskExecutor.java:193)
	at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
	at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
	at java.lang.Thread.run(Thread.java:745)

screen shot 2018-11-20 at 17 51 11

If error is dismissed, it will reappear once again and then again and again and again.

In my use-case, I have multiple services that I run, each with their own env file. This file is created only when I connect to a certain server, before I run the service locally (more specifically, using Telepresence to swap a service in a Kubernetes cluster and running it locally) and this file can be occasionally deleted - when I finish my session.

There are 2 different stacktrace patterns, the one I posted and another one that goes through a bunch of com.intellij.ui.mac.touchbar.* packages, I can add if it's of interest.

While I don't think that a missing env file should raise such a scary exception and instead either log a warning in the log once, or show a warning balloon when trying to run a Configuration with the missing file, I would also be fine with a config option to suppress this error.

@ashald ashald closed this as completed in 40a5089 Nov 28, 2018
@ashald
Copy link
Owner

ashald commented Nov 28, 2018

Unfortunately, this is one of those cases when there is no easy answer.
According to JetBrains API, extensions willing to perform run configuration validation are supposed to throw exceptions in a particular place. They used to catch particular sub-type of those exceptions and extract an error message. They're no longer doing that and just log exception as is so that it looks scary. I don't see any ways how I can address that gracefully at this time so for now I just added an option to skip validation and don't check if files exist. If files are missing they will be skipped during execution. Hope this helps.

This will be released with v3.1.0. I'm submitting an udpate right away but it usually takes couple of days for it to be published.

@nomaed
Copy link
Author

nomaed commented Nov 28, 2018

Thank you! I believe this control is very helpful.

@kolegran
Copy link

kolegran commented Jan 29, 2022

This not helps. Unfortunately :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants