hashicorp/nomad · error

failed to convert parsed config to map: %v

Error message

failed to convert parsed config to map: %v

What it means

This error occurs when hclutils.CtyValueToMapInterface fails to convert the parsed HCL config (a Cty value) into a plain Go map after the config was successfully set on the plugin. It indicates the validated config could not be serialized back to a generic map for the loader to return.

Source

Thrown at helper/pluginutils/loader/init.go:531

	b, ok := instance.Plugin().(base.BasePlugin)
	if !ok {
		return nil, fmt.Errorf("dispensed plugin %s doesn't meet base plugin interface", id)
	}

	c := &base.Config{
		PluginConfig: cdata,
		AgentConfig:  nil,
		ApiVersion:   info.apiVersion,
	}

	if err := b.SetConfig(c); err != nil {
		return nil, fmt.Errorf("setting config on plugin failed: %v", err)
	}

	parsedConfig, err := hclutils.CtyValueToMapInterface(val)
	if err != nil {
		return nil, fmt.Errorf("failed to convert parsed config to map: %v", err)
	}

	return parsedConfig, nil
}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Inspect the wrapped %v message to identify the un-convertible Cty value/type.
  2. Simplify the plugin config (avoid exotic nested/object types) if the schema allows exotic types.
  3. Ensure Nomad and any external plugin use compatible versions so schemas produce convertible Cty values.
  4. If reproducible with a stock config, file/upgrade against the Nomad version — this is usually an internal bug.
Defensive patterns

Strategy: try-catch

Try / catch

parsed, err := validatePluginConfig(...)
if err != nil && strings.Contains(err.Error(), "failed to convert parsed config to map") {
    // internal conversion failure: capture config + Nomad version for bug report
    return fmt.Errorf("cty conversion bug (nomad %s): %w", version.Version, err)
}

Prevention

When it happens

Trigger: validatePluginConfig, after a successful b.SetConfig(c), calls hclutils.CtyValueToMapInterface(val) and the Cty-to-map conversion errors — typically when `val` contains Cty types unsupported by the converter or is malformed.

Common situations: Plugin config schema includes exotic Cty types (e.g. certain capsule/atomic types) that CtyValueToMapInterface cannot represent; internal inconsistency between the HCL parser output and the converter's expectations; version skew between hclutils and the schema.

Related errors


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