harness / harness/harness-cli

hc auth login: HAR-unlicensed accounts get a silent, repeated "RegistryURL missing" warning instead of the real error, with misleading advice to re-login

Open
#101 0 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Go
Stars
25
Forks
25
PR merge metrics
No merged PRs in 30d

Description

What happens

On hc auth login, fetchRegistryURL (cmd/auth/login.go) calls
GET {apiURL}/gateway/har/api/v3/system/info?accountIdentifier=<accountId>
to populate RegistryURL. For an account with no HAR (Artifact Registry)
license, this endpoint returns:

{"message":"license not found."}

Instead of surfacing that, login.go swallows it into a generic
Warning: Failed to fetch registry URL: ..., saves RegistryURL: "" to
~/.harness/auth.json anyway, and reports login as successful.

Then on every subsequent hc invocation — regardless of command — a
startup check re-reads the saved empty RegistryURL and reprints:

RegistryURL missing , Please logout and login again

This happens even for commands that have nothing to do with registries
(hc version, hc auth status, hc help).

Why this is misleading

"Please logout and login again" is actively bad advice here: the root
cause is that the account has no HAR license, so logging out and back in
reproduces the exact same warning every time, with no path to actually
clear it short of licensing HAR. The message gives no indication that a
licensing issue, rather than a stale session, is the actual cause.

Suggested fix

  • Surface the real upstream error (e.g. "license not found") instead of
    a generic "missing" message, so a user isn't sent looking for an auth
    problem that doesn't exist.
  • Don't suggest logging out/in when the root cause isn't session-related.
  • Consider only checking/warning about RegistryURL for subcommands that
    actually need it (registry/artifact/pkgmgr), rather than on every
    invocation at startup.

Repro

On an account with no HAR license: hc auth login (succeeds, with the
warning), then run any other command, e.g. hc version — the same
warning reprints unconditionally.

Version

hc version 1.3.43, built with go1.25.0

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in cmd/auth/login.go at fetchRegistryURL and reproduce with hc auth login on an account without a HAR license, then run hc version or hc help. Trace the startup check that reads ~/.harness/auth.json; done means the upstream license error is visible, logout/login is not suggested for it, and RegistryURL warnings are limited to commands that need registries.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
authentication, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Active
Clarity
Mostly clear
Newbie friendliness
55/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.