hydracluster nodes list printed "No nodes enrolled." on a workstation while the same fleet had 43 nodes and 29 scales. It is not a misconfiguration and it produces no error. A silent wrong answer is worse than a failure, and this one already misled a live investigation.
nodes list reads a local YAML store, not the API:
// internal/cli/cluster/nodes.go:164
func loadNodesStore() (*store.Store, error) {
nodesPath := filepath.Join(cli.GetDataDir(), "nodes.yaml")
return store.Load(nodesPath)
}
And store.Load treats a missing file as an empty store:
// pkg/store/store.go:210
data, err := os.ReadFile(path)
if err != nil {
if os.IsNotExist(err) {
return &Store{path: path}, nil
}
~/.hydracluster/nodes.yaml is the server's data file and does not exist on any other machine. So off-server the store loads empty, len(nodes) == 0, and the command confidently prints "No nodes enrolled."
CLAUDE.md already says nodes is a server-only command, so running it elsewhere is a user error. The bug is that the user error is indistinguishable from a true answer.
An empty fleet is a plausible answer, not an absurd one, so nothing prompts you to doubt it. I concluded I could not locate a scale partly on this output. A colleague querying GET /api/v1/nodes with the admin token from the same ~/.hydracluster/config.yaml got 43 nodes from the same machine, which is how the discrepancy surfaced at all.
The config that would have answered correctly was already present: server.domain and server.admin_token are both set in ~/.hydracluster/config.yaml. The command simply never looks at them.
nodes list use the API when a server config is present, falling back to the local store only when it is actually running on the server. The credentials are already there and it is what every user off-server means by the command.store.Load returning a fresh store for a missing file is right for the server's first run; the caller should know which it got. Have nodes list say no nodes.yaml at <path>; this is a server-only command, use GET /api/v1/nodes from a client rather than "No nodes enrolled."Option 2 is the smallest change and already removes the silent-lie property. Option 1 is the one that makes the command do what people expect.
store.Load's missing-file behaviour is correct and should not change; LoadAllocation in pkg/store/slot_lease.go:99 does the same thing for the same good reason. The fix belongs in the caller, not the store.
During the GitHub org migration work, while trying to establish where hydrascaleregistry runs. The answer is that it is not a scale at all: it is its own Hetzner box, releasesandscaleregistry, which no amount of correct fleet listing would have revealed. But the empty output sent the search the wrong way first.
Closing this as done. The defect it describes is fixed and verified: a missing store no longer reports an empty fleet, and the server's pre-enrollment path still prints No nodes enrolled. Commit f085096 on origin/main.
Independently reviewed. The one gap worth probing was whether a stat failure that is not ErrNotExist — a permission problem, an unreadable path component — would fall through to the old message and reintroduce the silent lie by another route. It cannot: store.Load already returns an error for anything that is not IsNotExist, so the command fails before reaching that branch. The only way to reach the stat with an odd error is the file vanishing between the two calls.
Option 1 is split out as #1181 rather than left buried here: having nodes list query the API when a server config is present. It is unclaimed, and it carries a trap worth reading before anyone starts — a silent fallback to the local store when the API call fails would recreate exactly the bug this ticket removed.
Fixed and pushed:
f085096onorigin/main. I took the middle option, the floor we agreed on, and left the API version unimplemented.The two causes are now told apart:
nodes.yaml(any client machine): names the path it looked in, says the command reads the server's own file and never queries the API so it cannot answer off-server, and points atGET /api/v1/nodeswith the note that the domain and admin token are already in the caller's config.nodes.yamlpresent but empty (the server before its first enrollment): still printsNo nodes enrolled.No regression there, which is why this does not return a non-zero exit.store.Loadis unchanged, as discussed. A missing file genuinely is an empty store to its caller,LoadAllocationdoes the same for the same reason, and the caller was the one claiming knowledge it did not have. The newnodesStorePath()exists only so the caller can stat whatloadNodesStorereads.Verified against the built binary rather than asserted, since the whole defect is a command confidently printing something untrue:
go build ./...,go vet ./...andgo test ./...all clean. (A firstgo vetrun failed withcould not import fmtfrom inside the Go toolchain's own stdlib; that was a cold build cache, not this change, and it passed once the cache repopulated.)Still open from this ticket: option 1, having
nodes listcall the API when a server config is present. That is the change that makes the command do what people off-server actually mean, and it is a different shape of work: a client path, a flag or heuristic for which mode to use, and error handling for an unreachable server. Worth its own pass.Decision note on the exit code. I considered returning an error so a script could not read the missing-store case as success. I did not, because the same condition is true on a freshly installed server before its first enrollment, and turning that into a failure trades one wrong answer for another. The silent-lie property is removed by the output no longer claiming anything about the fleet.