-
Notifications
You must be signed in to change notification settings - Fork 169
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
Confusing error message #817
Comments
julienduchesne
added a commit
that referenced
this issue
Mar 23, 2023
Closes #817 This is something that comes up quite often in our internal environments When a data structure is not a Kubernetes manifest, the error makes it hard to find out why This adds a reason, and context for why the object we found isn't a Kubernetes object In the issue being closed, the error was: ``` >> tk show environments/default Error: got an error while extracting env `environments/default`: recursion did not resolve in a valid Kubernetes object. In path `.grafana.deployment` found key `apiVersion` of type `string` instead. ``` It is now: ``` >> tk show environments/default Error: got an error while extracting env `environments/default`: recursion ended on key "apiVersion" of type string which does not belong to a valid Kubernetes object instead, it an attribute of the following object: apiVersion: apps/v1 kind: 3000 metadata: name: grafana spec: selector: matchLabels: name: grafana template: metadata: labels: name: grafana spec: containers: - image: grafana/grafana name: grafana ports: - containerPort: 3000 name: ui this object is not a valid Kubernetes object because: attribute "kind" is not a string, it is a float64 ``` More verbose, but it actually helps the user find the error
julienduchesne
added a commit
that referenced
this issue
Mar 27, 2023
* Improved manifest extraction errors Closes #817 This is something that comes up quite often in our internal environments When a data structure is not a Kubernetes manifest, the error makes it hard to find out why This adds a reason, and context for why the object we found isn't a Kubernetes object In the issue being closed, the error was: ``` >> tk show environments/default Error: got an error while extracting env `environments/default`: recursion did not resolve in a valid Kubernetes object. In path `.grafana.deployment` found key `apiVersion` of type `string` instead. ``` It is now: ``` >> tk show environments/default Error: got an error while extracting env `environments/default`: recursion ended on key "apiVersion" of type string which does not belong to a valid Kubernetes object instead, it an attribute of the following object: apiVersion: apps/v1 kind: 3000 metadata: name: grafana spec: selector: matchLabels: name: grafana template: metadata: labels: name: grafana spec: containers: - image: grafana/grafana name: grafana ports: - containerPort: 3000 name: ui this object is not a valid Kubernetes object because: attribute "kind" is not a string, it is a float64 ``` More verbose, but it actually helps the user find the error * Linting! * Add back path of object. Forgot it in the err message * Better error!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
While I was restructuring my code to avoid #816 I made a mistake and ran into a confusing error message:
This is confusing because it says found key instead.... but instead of what? What key is expected? What type is expected?
To make it more confusing the apiVersion is perfectly valid:
apiVersion: 'apps/v1'
Eventually I realized that it was actually a different line that was the problem,
kind: _config.grafana['port'],
. I forgot to remove a bad attribute reference when I was doing some testing a while back. The reference resolved into"kind": 3000
, which is a invalid type for that attribute.Anyways, I know it's a small issue, but an error message like this would be great:
Reproduction repo: https://github.com/Almenon/tk_confusing_error_example/tree/main
The text was updated successfully, but these errors were encountered: