hashicorp/nomad · error

unexpectedly did not forward Variables.List to region %q

Error message

unexpectedly did not forward Variables.List to region %q

What it means

namespaceNoAssociatedVarsInRegion forwards a Variables.List RPC to a remote region to verify no variables remain in the namespace before deletion. If the forward helper returns done=false — the RPC was not actually sent to the remote region's server — this internal error is returned naming the region. It is an invariant check on the forwarding layer, not a user data problem.

Source

Thrown at nomad/namespace_endpoint.go:415

	return true, nil
}

// namespaceNoAssociatedVarsInRegion returns true if there are no variables
// associated with the namespace in the given region.
func (n *Namespace) namespaceNoAssociatedVarsInRegion(authToken, namespace, region string) (bool, error) {
	varReq := &structs.VariablesListRequest{
		QueryOptions: structs.QueryOptions{
			Region:     region,
			Namespace:  namespace,
			AllowStale: false,
			AuthToken:  authToken,
		},
	}

	var varResp structs.VariablesListResponse
	done, err := n.srv.forward("Variables.List", varReq, varReq, &varResp)
	if !done {
		return false, fmt.Errorf("unexpectedly did not forward Variables.List to region %q", region)
	} else if err != nil {
		return false, err
	}

	for _, v := range varResp.Data {
		if v.Namespace == namespace {
			return false, nil
		}
	}
	return true, nil
}

// ListNamespaces is used to list the namespaces
func (n *Namespace) ListNamespaces(args *structs.NamespaceListRequest, reply *structs.NamespaceListResponse) error {

	authErr := n.srv.Authenticate(n.ctx, args)
	if done, err := n.srv.forward("Namespace.ListNamespaces", args, args, reply); done {
		return err

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Restore federation/connectivity to the affected region (verify nomad server members and RPC logs).
  2. Correct the region name used by clients/servers if misspelled.
  3. Retry the namespace deletion once the region is healthy.
Defensive patterns

Strategy: retry

Validate before calling

for _, region := range regions {
    if _, _, err := client.Agent().MembersOpts(&api.QueryOptions{Region: region}); err != nil {
        return fmt.Errorf("region %s unreachable before variables check: %w", region, err)
    }
}

Try / catch

if err != nil && strings.Contains(err.Error(), "did not forward Variables.List") {
    // check region health/federation, restore, retry
}

Prevention

When it happens

Trigger: Namespace delete triggering the variables check across regions; forwarding to a peer region fails to dispatch because the region is down, not federated, or the region name is wrong.

Common situations: Multi-region Nomad with variables in use; a region that lost gossip connectivity; tooling using region names that do not match server configuration.

Related errors


AI-assisted analysis of hashicorp/nomad@482b49bf1a (2026-09-04). Data as JSON: /api/errors/15d345b3c363a790. Report an issue: GitHub.