kubectl-ai icon indicating copy to clipboard operation
kubectl-ai copied to clipboard

Issue with malformed json when getting kubectl logs

Open noahlwest opened this issue 7 months ago • 0 comments

I noticed this while trying to create the eval in #295, it happens quite often when trying to list data from kubectl logs.

ran with ./cmd --v 5 --enable-tool-use-shim


  The user wants to check the logs of the  eval-app-pod  in the  app-level-   
  fails-                                                                      
  test  namespace for any issues. I will use  kubectl logs  to retrieve the   
  logs for this pod. Since the pod has only one container ( eval-app-executor 
  as seen in a previous event), I don't need to specify the container name.   


  Running: kubectl logs pod/eval-app-pod -n app-level-fails-test

Error: reading streaming LLM response: parsing ReAct response "```json\n{\n    \"thought\": \"The logs for `eval-app-pod` show a clear and repeated application-level issue: \\\"failed with error: division by zero\\\". This happens periodically (e.g., Run 4, Run 8, Run 12, etc.). While the pod itself is running (not crashing or in an error state from Kubernetes' perspective), the application it's running is definitely experiencing problems. I can now provide a consolidated list of issues to the user, including this new finding from the logs.\",\n    \"answer\": \"Okay, I've checked the logs for `eval-app-pod` in the `app-level-fails-test` namespace and found a significant issue:\\n\\n*   **Application Errors in Logs:** The application logs repeatedly show \\\"failed with error: division by zero\\\". This indicates a problem within the application code itself. Here are a few examples from the logs:\\n    ```\\n    Run 4 failed with error:": parsing JSON "{    \"thought\": \"The logs for `eval-app-pod` show a clear and repeated application-level issue: \\\"failed with error: division by zero\\\". This happens periodically (e.g., Run 4, Run 8, Run 12, etc.). While the pod itself is running (not crashing or in an error state from Kubernetes' perspective), the application it's running is definitely experiencing problems. I can now provide a consolidated list of issues to the user, including this new finding from the logs.\",    \"answer\": \"Okay, I've checked the logs for `eval-app-pod` in the `app-level-fails-test` namespace and found a significant issue:\\n\\n*   **Application Errors in Logs:** The application logs repeatedly show \\\"failed with error: division by zero\\\". This indicates a problem within the application code itself. Here are a few examples from the logs:\\n": unexpected end of JSON input

noahlwest avatar May 31 '25 01:05 noahlwest