hashicorp/nomad · critical
setting up server node ID failed: %s
Error message
setting up server node ID failed: %s
What it means
After building the server config, setupServer calls setupNodeID to generate or read the persisted node ID. Failure here (usually filesystem errors on the node ID file) is wrapped as this error and NewAgent aborts.
Source
Thrown at command/agent/agent.go:1190
return conf, nil
}
// setupServer is used to setup the server if enabled
func (a *Agent) setupServer() error {
if !a.config.Server.Enabled {
return nil
}
// Setup the configuration
conf, err := a.serverConfig()
if err != nil {
return fmt.Errorf("server config setup failed: %s", err)
}
// Generate a node ID and persist it if it is the first instance, otherwise
// read the persisted node ID.
if err := a.setupNodeID(conf); err != nil {
return fmt.Errorf("setting up server node ID failed: %s", err)
}
// Sets up the keyring for gossip encryption
if err := a.setupKeyrings(conf); err != nil {
return fmt.Errorf("failed to configure keyring: %v", err)
}
// Create the server
server, err := nomad.NewServer(conf,
a.consulCatalog, // self service discovery
a.consulConfigEntriesFunc, // writing config entries for gateways
)
if err != nil {
return fmt.Errorf("server setup failed: %v", err)
}
a.server = server
// Consul check addresses default to bind but can be toggled to use advertiseView on GitHub (pinned to 482b49bf1a)
Solutions
- Check data_dir/server is writable by the Nomad process user
- Fix ownership/permissions of the node_id file (chown/chmod) or remove it to regenerate
- Verify disk space and that the filesystem is not mounted read-only
- If node_id was manually set in config, ensure it is a valid UUID and consistent with the persisted file
Example fix
// before (shell) ls -l /var/lib/nomad/server/node_id # owned by root, nomad cannot read // after (shell) chown nomad:nomad /var/lib/nomad/server/node_id && chmod 600 /var/lib/nomad/server/node_id
Defensive patterns
Strategy: validation
Validate before calling
nodeIDPath := filepath.Join(dataDir, "server", "node_id")
if f, err := os.OpenFile(nodeIDPath, os.O_RDWR, 0600); err != nil {
log.Fatalf("cannot access node ID file %s: %v", nodeIDPath, err)
} else {
f.Close()
} Try / catch
if err := setupNodeID(conf); err != nil {
return fmt.Errorf("setting up server node ID failed: %w", err)
} Prevention
- Run the agent under a consistent user with ownership of data_dir
- Monitor disk space and avoid read-only remounts on data_dir volumes
- Never hand-edit or copy node_id between servers
- Restore data_dir snapshots with correct ownership/permissions
When it happens
Trigger: setupNodeID fails while creating or reading <data_dir>/server/node_id: unwritable data_dir, node_id file with bad permissions/corruption, or provided node_id conflicting with persisted state.
Common situations: Disk full or read-only filesystem on /var/lib/nomad, running the agent as a different user than the one owning data_dir, restoring data_dir snapshots with wrong ownership, or manual node_id edits.
Related errors
AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04).
Data as JSON: /api/errors/ea8296c009b74aba.
Report an issue: GitHub.