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

Provides a better error message when Kestra cannot be started due to misconfiguration #4155

Closed
loicmathieu opened this issue Jun 27, 2024 · 1 comment · Fixed by #4171 or #4367
Closed
Labels
enhancement New feature or request kind/quick-win Seems to be quick to do

Comments

@loicmathieu
Copy link
Member

Feature description

When Kestra cannot be started due to misconfiguration, en error like this one is displayed on the log:

D:\code\kestra> .\kestra-0.17.7.bat server standalone
Exception in thread "main" io.micronaut.context.exceptions.BeanInstantiationException: Bean definition [io.kestra.webserver.services.BasicAuthService] could not be loaded: Failed to inject value for field [settingRepository] of class: io.kestra.webserver.services.BasicAuthService

Message: No bean of type [io.kestra.core.repositories.SettingRepositoryInterface] exists.
* [H2SettingRepository] a candidate of [SettingRepositoryInterface] is disabled because:
 - Required property [kestra.repository.type] with value [h2] not present
* [MysqlSettingRepository] a candidate of [SettingRepositoryInterface] is disabled because:
 - Required property [kestra.repository.type] with value [mysql] not present
* [PostgresSettingRepository] a candidate of [SettingRepositoryInterface] is disabled because:
 - Required property [kestra.repository.type] with value [postgres] not present
Path Taken: new BasicAuthService() --> BasicAuthService.settingRepository
        at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1982)
        at io.micronaut.context.DefaultApplicationContext.initializeContext(DefaultApplicationContext.java:294)
        at io.micronaut.context.DefaultBeanContext.readAllBeanDefinitionClasses(DefaultBeanContext.java:3348)
        at io.micronaut.context.DefaultBeanContext.finalizeConfiguration(DefaultBeanContext.java:3692)
        at io.micronaut.context.DefaultBeanContext.start(DefaultBeanContext.java:342)
        at io.micronaut.context.DefaultApplicationContext.start(DefaultApplicationContext.java:202)
        at io.micronaut.configuration.picocli.MicronautFactory.<init>(MicronautFactory.java:59)
        at io.kestra.cli.App.execute(App.java:67)
        at io.kestra.cli.App.main(App.java:50)
Caused by: io.micronaut.context.exceptions.DependencyInjectionException: Failed to inject value for field [settingRepository] of class: io.kestra.webserver.services.BasicAuthService

Message: No bean of type [io.kestra.core.repositories.SettingRepositoryInterface] exists.
* [H2SettingRepository] a candidate of [SettingRepositoryInterface] is disabled because:
 - Required property [kestra.repository.type] with value [h2] not present
* [MysqlSettingRepository] a candidate of [SettingRepositoryInterface] is disabled because:
 - Required property [kestra.repository.type] with value [mysql] not present
* [PostgresSettingRepository] a candidate of [SettingRepositoryInterface] is disabled because:
 - Required property [kestra.repository.type] with value [postgres] not present
Path Taken: new BasicAuthService() --> BasicAuthService.settingRepository
        at io.micronaut.context.AbstractInitializableBeanDefinition.resolveBean(AbstractInitializableBeanDefinition.java:2177)
        at io.micronaut.context.AbstractInitializableBeanDefinition.getBeanForField(AbstractInitializableBeanDefinition.java:1668)
        at io.kestra.webserver.services.$BasicAuthService$Definition.inject(Unknown Source)
        at io.kestra.webserver.services.$BasicAuthService$Definition.instantiate(Unknown Source)
        at io.micronaut.context.DefaultBeanContext.resolveByBeanFactory(DefaultBeanContext.java:2311)
        at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2281)
        at io.micronaut.context.DefaultBeanContext.doCreateBean(DefaultBeanContext.java:2293)
        at io.micronaut.context.DefaultBeanContext.createRegistration(DefaultBeanContext.java:3095)
        at io.micronaut.context.SingletonScope.getOrCreate(SingletonScope.java:80)
        at io.micronaut.context.DefaultBeanContext.findOrCreateSingletonBeanRegistration(DefaultBeanContext.java:2997)
        at io.micronaut.context.DefaultBeanContext.initializeEagerBean(DefaultBeanContext.java:2678)
        at io.micronaut.context.DefaultBeanContext.initializeContext(DefaultBeanContext.java:1976)
        ... 8 more
Caused by: io.micronaut.context.exceptions.NoSuchBeanException: No bean of type [io.kestra.core.repositories.SettingRepositoryInterface] exists.
* [H2SettingRepository] a candidate of [SettingRepositoryInterface] is disabled because:
 - Required property [kestra.repository.type] with value [h2] not present
* [MysqlSettingRepository] a candidate of [SettingRepositoryInterface] is disabled because:
 - Required property [kestra.repository.type] with value [mysql] not present
* [PostgresSettingRepository] a candidate of [SettingRepositoryInterface] is disabled because:
 - Required property [kestra.repository.type] with value [postgres] not present
        at io.micronaut.context.DefaultBeanContext.newNoSuchBeanException(DefaultBeanContext.java:2768)
        at io.micronaut.context.DefaultApplicationContext.newNoSuchBeanException(DefaultApplicationContext.java:309)
        at io.micronaut.context.DefaultBeanContext.resolveBeanRegistration(DefaultBeanContext.java:2737)
        at io.micronaut.context.DefaultBeanContext.getBean(DefaultBeanContext.java:1731)
        at io.micronaut.context.AbstractBeanResolutionContext.getBean(AbstractBeanResolutionContext.java:89)
        at io.micronaut.context.AbstractInitializableBeanDefinition.resolveBean(AbstractInitializableBeanDefinition.java:2161)
        ... 19 more

A user not knowing how Kestra work has no way to understand what's going on, this is usually due to missing configuration so we should detect this and points to the correct configuration guide.

We should check preconditions on all Kestra server commands and display a nice error message for the common cause of misconfiguration that is missing queue, repository or storage configuration.

@loicmathieu
Copy link
Member Author

Closed in #4367 as #4171 was reverted

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request kind/quick-win Seems to be quick to do
Projects
Archived in project
1 participant