hashicorp/nomad · error

setting config for plugin %s failed: %v

Error message

setting config for plugin %s failed: %v

What it means

Dispense, after a successful base cast, calls b.SetConfig with the plugin's msgpack config, the agent config, and API version. If SetConfig fails the instance is killed to avoid a leaked process and this error wraps the plugin's own error. This is the runtime-path counterpart of error 1850, but with a real launched instance.

Source

Thrown at helper/pluginutils/loader/loader.go:205

		}
	}

	// Cast to the base type and set the config
	b, ok := instance.Plugin().(base.BasePlugin)
	if !ok {
		instance.Kill() // Ensure plugin is not left running
		return nil, fmt.Errorf("plugin %s doesn't implement base plugin interface", id)
	}

	c := &base.Config{
		PluginConfig: pinfo.msgpackConfig,
		AgentConfig:  config,
		ApiVersion:   pinfo.apiVersion,
	}

	if err := b.SetConfig(c); err != nil {
		instance.Kill() // ensure plugin is not left running
		return nil, fmt.Errorf("setting config for plugin %s failed: %v", id, err)
	}

	return instance, nil
}

// Reattach reattaches to a previously launched external plugin.
func (l *PluginLoader) Reattach(name, pluginType string, config *plugin.ReattachConfig) (PluginInstance, error) {
	return l.dispensePlugin(pluginType, "", "", nil, config, l.logger)
}

// dispensePlugin is used to launch or reattach to an external plugin.
func (l *PluginLoader) dispensePlugin(
	pluginType, apiVersion, cmd string, args []string, reattach *plugin.ReattachConfig,
	logger log.Logger) (PluginInstance, error) {

	var pluginCmd *exec.Cmd
	if cmd != "" && reattach != nil {
		return nil, fmt.Errorf("both launch command and reattach config specified")

View on GitHub (pinned to 482b49bf1a)

Solutions

  1. Read the wrapped %v message — it contains the plugin's SetConfig rejection reason.
  2. Fix the plugin config in the agent config according to the plugin's error message.
  3. Align the plugin binary version with the agent so msgpackConfig schema and plugin expectations match.
  4. Check plugin stderr/logs for panics during its SetConfig handler.
  5. Rerun validation (`nomad agent config validate`) after correcting the config.

Example fix

// before
plugin "qemu" {
  config {
    args = ["-enable-kvm"]  # plugin requires image_path
  }
}
// after
plugin "qemu" {
  config {
    image_path = "/opt/images/linux.qcow2"
    args       = ["-enable-kvm"]
  }
}
Defensive patterns

Strategy: try-catch

Try / catch

inst, err := l.Dispense(name, ptype, agentCfg, logger)
if err != nil && strings.Contains(err.Error(), "setting config for plugin") {
    // wrapped plugin-side rejection; surface it to config authoring UI/logs
    return fmt.Errorf("plugin rejected its config: %w", err)
}

Prevention

When it happens

Trigger: Dispense (via validatePluginConfig or normal plugin use) when the plugin's SetConfig RPC returns an error: config fails the plugin's own validation, msgpack decode of pinfo.msgpackConfig fails inside the plugin, or the RPC transport breaks.

Common situations: Plugin rejects config values it considers invalid despite passing HCL schema validation; plugin process dies during SetConfig; config blob produced at load time doesn't match what the running plugin version expects.

Related errors


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