Replicatedctl throws "Array Index Out of Bounds Error"

While trying to update to new release via dashboard Even though the previous version was updated successfully Dashboard shows error and stalls subsequent update. When tried to stop and start app replicatedctl throws array index out of bounds error.

Error Trace:

error: error executing jsonpath "{.items[0]}": Error executing template: array index out of bounds: index 0, length 0. Printing more information for debugging the template:
template was:
object given to jsonpath engine was:
	map[string]interface {}{"apiVersion":"v1", "items":[]interface {}{}, "kind":"List", "metadata":map[string]interface {}{"resourceVersion":"", "selfLink":""}}

error: expected 'exec (POD | TYPE/NAME) COMMAND [ARG1] [ARG2] ... [ARGN]'.
POD or TYPE/NAME and COMMAND are required arguments for the exec command
See 'kubectl exec -h' for help and examples

Can you try running kubectl get pods

Yeah everything seems to be working fine.

Mani, there should a a label on the replicated pod tier: master. You can see the failing command that looks for it in the /usr/local/bin/replicatedctl scrip. Can you check what labels the pod has:

kubectl get pod replicated-<generated stuff> -o yaml | grep -w -5 labels

Can you also run the following command?

kubectl get pods -l tier=master

I think I found the reason for this issue.
This arises when I change my default namespace in context. This eventually means /usr/local/bin/replicatedctl should use -n default in the kubectl commands. Screenshot attached.
Should I raise an issue in any GitHub repo?

Works fine after updating namespace in /usr/local/bin/replicatedctl as follows

 sh -c "kubectl -n default exec -c replicated $flags \
          $(kubectl get pods -n default -o=jsonpath="{.items[0]}" -l tier=master) -- \
          replicatedctl$push $(printf "%s" "$opts")"

we will create an internal issue to track this

That would be great. Thanks.