Skip to content

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

Description

@wattdave

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions