Some commands in cf CLI versions below 6.48 fail with “No API endpoint set. Use 'cf login' or 'cf api' to target an endpoint.”
search cancel

Some commands in cf CLI versions below 6.48 fail with “No API endpoint set. Use 'cf login' or 'cf api' to target an endpoint.”

book

Article ID: 297420

calendar_today

Updated On:

Products

VMware Tanzu Application Service for VMs

Issue/Introduction

Some commands in cf CLI, versions 6.48 and below, fail with the error “No API endpoint set. Use 'cf login' or 'cf api' to target an endpoint” even when you have already targeted the correct endpoint:
>cf buildpacks
FAILED
No API endpoint set. Use 'cf login' or 'cf api' to target an endpoint.

This happens after you have used a higher version cf CLI 6.52+ on the same localhost but you still need to get back to use cf CLI versions that are below v6.48.

Resolution

The ConfigVersion property in the ~/.cf/config.json file was changed from 3 to 4 in cf CLI versions 6.52 and above. Thus, if you’re using cf CLI 6.52+, expect to have ` "ConfigVersion": 4,` in your config.json file. However, if you’re using cf CLI versions 6.48 and below, you should still have `"ConfigVersion": 3,` in this file.
 

If you find that ConfigVersion is still 4 when you need to use cf CLI versions 6.48 and below, this is due to a known issue as documented below:
 


The ConfigVersion property would not be reset on version mismatch unless it's on cf CLI version 6.49+. Thus, once you you have used higher versions of cf CLI 6.52+ on the same localhost, cf CLI versions 6.48 and below will always retain to use` "ConfigVersion": 4,` in the config, causing issues when running some commands.

To resolve this issue, the customer can consider upgrading to cf CLI version 6.49+ (it will be able to reset the config to default on version mismatch). Cleanup is also an option; cleanup the "~/.cf/config.json file" file manually before you need to use cf CLI versions 6.48 and below (the config file will be recreated with property `"ConfigVersion": 3,` once your cf logs in to versions 6.48 and below).