Skip to content

Conversation

@hammad-nasir-elastic
Copy link
Contributor

Resolves issue

Summary

Updating the error message in config_service.ts for the special use case when the provided config includes an enabled field and the validated config does not. The error message is more human friendly and specific to the enabled setting.

@hammad-nasir-elastic hammad-nasir-elastic self-assigned this Oct 30, 2025
@hammad-nasir-elastic hammad-nasir-elastic requested a review from a team as a code owner October 30, 2025 19:09
@hammad-nasir-elastic hammad-nasir-elastic added release_note:skip Skip the PR/issue when compiling release notes backport:skip This PR does not require backporting labels Oct 30, 2025
@elasticmachine
Copy link
Contributor

💛 Build succeeded, but was flaky

Failed CI Steps

Test Failures

  • [job] [logs] FTR Configs #36 / cases security and spaces enabled: basic Kibana index: Alerting & Cases "before all" hook for "migrates the cases SO from the .kibana index to the .kibana_alerting_cases correctly"

Metrics [docs]

✅ unchanged

History

cc @hammad-nasir-elastic

} catch (error) {
if (error instanceof ValidationError) {
throw new ValidationError(
new SchemaTypeError(
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so these are ultimately schema checks and we do have a better way to handle throwing custom validation errors within the schema validate function itself. https://github.com/elastic/kibana/blob/main/src/platform/packages/shared/kbn-config-schema/README.md#custom-validation

any reason why you did not do that here instead of catching and rethrowing?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hello! I reviewed the custom validation you shared, and from what I understand, it would mean adding custom validation to each plugin’s schema for plugins that don’t use the enabled field. To avoid updating all those plugins and because the isEnabledAtPath function is called for every discovered plugin when kibana is booting up, I figured I would do a try catch around the specific scenario in the code instead.

I also based my changes on the comments in this PR which I think suggest catching and throwing a specific error message.

Let me know if I missed anything or if you have other suggestions!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport:skip This PR does not require backporting release_note:skip Skip the PR/issue when compiling release notes

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Config Service] Human-friendly error message when config has enabled flag but it's not in the schema

4 participants