Skip to content
6 changes: 6 additions & 0 deletions messages/logout.md
Original file line number Diff line number Diff line change
Expand Up @@ -79,3 +79,9 @@ You must specify a target-org (or default target-org config is set) or use --all
# noOrgSpecifiedWithJson

You must specify a target-org (or default target-org config is set) or use --all flag when using the --json flag.

# warning.NoAuthFoundForTargetOrg

No authenticated org found with the %s username or alias.

NOTE: Starting September 2025, this warning will be converted to an error. As a result, the exit code when you try to log out of an unauthenticated org will change from 0 to 1.
1 change: 1 addition & 0 deletions src/commands/org/logout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ export default class Logout extends SfCommand<AuthLogoutResults> {

if (orgAuths.length === 0) {
if (flags['target-org']) {
this.warn(messages.createWarning('warning.NoAuthFoundForTargetOrg', [flags['target-org']]));
// user specified a target org but it was not resolved, issue success message and return
this.logSuccess(messages.getMessage('logoutOrgCommandSuccess', [flags['target-org']]));
return [flags['target-org']];
Expand Down
2 changes: 1 addition & 1 deletion test/commands/org/logout.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ describe('org:logout', () => {
expect(response).to.deep.equal([testOrg1.username]);
});

it('should not fail when the auth file does not exist', async () => {
it('should fail when the auth file does not exist', async () => {
await prepareStubs({
'target-org': testOrg2.username,
aliases: { TestAlias: testOrg1.username },
Expand Down