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

Mismatch of config.toml with git checkout and image in podman compose: pydantic_core._pydantic_core.ValidationError: 1 validation error for KaiConfig - Unable to extract tag using discriminator 'provider' [type=union_tag_not_found, input_value={'solution_detectors': 'n...'password': 'dog8code'}}, input_type=dict] #264

Closed
jwmatthews opened this issue Jul 29, 2024 · 1 comment · Fixed by #353

Comments

@jwmatthews
Copy link
Member

I think the below is due to a mismatch where we are tagging images to isolate all changes, but we allow the config to be modified and used from the local checkout.

So in my situation:'
-> running podman compose up that uses a :stable tag pointing to: commit 65a5761d479d84c15ccf0769e2bf00ea71a4836c
-> My kai checkout of 'main' is at commit 11a28d32992d9888234c2ea3a630a52733a48842

With this combination, the code running inside of the :stable image is reading the local checkout to parse the kai/config.toml and its crashing as I suspect we changed structure of kai/config.toml

Error from podman compose up

kai-1     |   File "/kai/kai/server.py", line 265, in app
kai-1     |     config = KaiConfig.model_validate_filepath(
kai-1     |              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kai-1     |   File "/kai/kai/models/kai_config.py", line 125, in model_validate_filepath
kai-1     |     return KaiConfig.model_validate(model_dict)
kai-1     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kai-1     |   File "/opt/app-root/lib64/python3.12/site-packages/pydantic/main.py", line 551, in model_validate
kai-1     |     return cls.__pydantic_validator__.validate_python(
kai-1     |            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
kai-1     | pydantic_core._pydantic_core.ValidationError: 1 validation error for KaiConfig
kai-1     | incident_store
kai-1     |    pydantic_core._pydantic_core.ValidationError: 1 validation error for KaiConfig
kai-1     |     For further information visit https://errors.pydantic.dev/2.7/v/union_tag_not_found

https://gist.github.com/jwmatthews/2619140e479c4029b5e90d9639d41a68

The workaround for now is:

  • git checkout stable
  • podman compose up

This problem will fade away when we bump the stable tag to match main, yet there is potential for it to reoccur as long as we allow a relationship of the container image reading local disk for kai/config.toml... in theory the config file does not change often so the problem isn't expected to occur a lot, but its a potential breakage we may want to isolate.

@jwmatthews jwmatthews changed the title pydantic_core._pydantic_core.ValidationError: 1 validation error for KaiConfig - pydantic_core._pydantic_core.ValidationError: 1 validation error for KaiConfig pydantic_core._pydantic_core.ValidationError: 1 validation error for KaiConfig - Unable to extract tag using discriminator 'provider' [type=union_tag_not_found, input_value={'solution_detectors': 'n...'password': 'dog8code'}}, input_type=dict] Jul 29, 2024
@jwmatthews jwmatthews changed the title pydantic_core._pydantic_core.ValidationError: 1 validation error for KaiConfig - Unable to extract tag using discriminator 'provider' [type=union_tag_not_found, input_value={'solution_detectors': 'n...'password': 'dog8code'}}, input_type=dict] Mismatch of config.toml with git checkout and image in podman compose: pydantic_core._pydantic_core.ValidationError: 1 validation error for KaiConfig - Unable to extract tag using discriminator 'provider' [type=union_tag_not_found, input_value={'solution_detectors': 'n...'password': 'dog8code'}}, input_type=dict] Aug 30, 2024
@jwmatthews
Copy link
Member Author

We plan to address this in #320

The idea is that most settings will be overridden via environment variables, if the user wants/needs to make config settings, they may copy the build/config_example.toml to build/config.toml and edit what they need and this will be used and take precedence from podman compose up.

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

Successfully merging a pull request may close this issue.

1 participant