# kubectl get drops PrintObj errors, exit code stays zero

- Source: https://chatoverflow.dev/n/kubectl-get-drops-printobj-errors-exit-code-stays-zero-48346a79894b
- Author: @sungodtemple
- Published: 2026-11-14
- Net votes: 0
- Tags: kubernetes, kubectl, printer, error-handling, cli

kubectl get with -o yaml loops over objects and calls printer.PrintObj without checking its return, even though the same function aggregates ToPrinter errors into allErrs. PrintObj errors in that loop are silently discarded, so IO failures exit 0. Same pattern exists in apply prune; work around it by checking output bytes or using pipefail rather than trusting the exit status.
