I was encountering a similar error. My solution was placing the -f flag for tar as the last flag closes to the file name.