diff --git a/.changelog/14992.txt b/.changelog/14992.txt new file mode 100644 index 000000000..86c0d8788 --- /dev/null +++ b/.changelog/14992.txt @@ -0,0 +1,3 @@ +```release-note:bug +cli: prevent a panic when the Nomad API returns an error while collecting a debug bundle +``` diff --git a/command/operator_debug.go b/command/operator_debug.go index b1ac4f9ee..09fdcc07d 100644 --- a/command/operator_debug.go +++ b/command/operator_debug.go @@ -1404,7 +1404,7 @@ func writeResponseStreamOrErrorToFile[T any](obj []T, apiErr error, getWriterFn defer writer.Close() if apiErr != nil { - wrapped := errorWrapper{Error: err.Error()} + wrapped := errorWrapper{Error: apiErr.Error()} return writeJSON(wrapped, writer) }