hashicorp/nomad · error

configuration not allowed but config passed

Error message

configuration not allowed but config passed

What it means

In validatePluginConfig, if the plugin reported no configuration schema (info.configSchema == nil), the plugin declares it accepts no configuration. If the user nonetheless supplied a config block for that plugin, the loader rejects it with this error since there is no schema to validate or send the config against. It is a strict misuse guard, not a runtime fault.

Source

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

		config[id.Name] = &InternalPluginConfig{
			Config: pc,
		}
	}

	return config, mErr.ErrorOrNil()
}

// validatePluginConfig is used to validate the plugin's configuration. If the
// plugin has a config, it is parsed with the plugins config schema and
// SetConfig is called to ensure the config is valid.
func (l *PluginLoader) validatePluginConfig(id PluginID, info *pluginInfo) (map[string]interface{}, error) {
	var mErr multierror.Error

	// Check if a config is allowed
	if info.configSchema == nil {
		if info.config != nil {
			return nil, fmt.Errorf("configuration not allowed but config passed")
		}

		// Nothing to do
		return nil, nil
	}

	// Convert the schema to hcl
	spec, diag := hclspecutils.Convert(info.configSchema)
	if diag.HasErrors() {
		_ = multierror.Append(&mErr, diag.Errs()...)
		return nil, multierror.Prefix(&mErr, "failed converting config schema:")
	}

	// If there is no config, initialize it to an empty map so we can still
	// handle defaults
	if info.config == nil {
		info.config = map[string]interface{}{}
	}

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Remove the config block for that plugin from the agent configuration — the plugin accepts no configuration.
  2. Confirm which plugin the config was intended for and move it to the correct plugin's stanza.
  3. If the plugin should support config, upgrade to a plugin version whose ConfigSchema() declares a schema, or fix the plugin to return its hclspec schema.
  4. Check for plugin version drift: a downgraded binary may have lost its schema while old config remains.

Example fix

// before (agent config)
plugin "my-driver" {
  config {
    endpoint = "unix:///var/run/foo.sock"
  }
}
// after (plugin declares no schema — remove config)
plugin "my-driver" {}
Defensive patterns

Strategy: validation

Validate before calling

// Only pass config if the plugin actually declares a schema
schema := pluginInfo.ConfigSchema // nil means no config allowed
if schema == nil && userConfig != nil {
    return fmt.Errorf("plugin %q accepts no config; remove the config block", pluginName)
}

Type guard

func acceptsConfig(schema *hclspec.Spec) bool { return schema != nil }

Try / catch

if err := loader.Load(cfg); err != nil {
    if strings.Contains(err.Error(), "configuration not allowed but config passed") {
        log.Printf("removing config for schema-less plugin; retrying without it")
        cfg = stripPluginConfig(cfg)
        return loader.Load(cfg)
    }
    return err
}

Prevention

When it happens

Trigger: Calling plugin loading/initialization with a plugin config entry (e.g. a task-driver or CSI plugin config map) for a plugin whose ConfigSchema() returned nil, i.e. any config passed to validatePluginConfig for a schema-less plugin.

Common situations: User adds a plugin "config" block in agent configuration for a plugin that doesn't support configuration; leftover config after switching to a newer/older plugin binary that dropped its schema; typo where config was meant for a different plugin.

Related errors


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