{"record":{"id":"3e314942ac63950b","repo":"hashicorp/nomad","slug":"configuration-not-allowed-but-config-passed","errorCode":null,"errorMessage":"configuration not allowed but config passed","messagePattern":"configuration not allowed but config passed","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"helper/pluginutils/loader/init.go","lineNumber":470,"sourceCode":"\n\t\tconfig[id.Name] = &InternalPluginConfig{\n\t\t\tConfig: pc,\n\t\t}\n\t}\n\n\treturn config, mErr.ErrorOrNil()\n}\n\n// validatePluginConfig is used to validate the plugin's configuration. If the\n// plugin has a config, it is parsed with the plugins config schema and\n// SetConfig is called to ensure the config is valid.\nfunc (l *PluginLoader) validatePluginConfig(id PluginID, info *pluginInfo) (map[string]interface{}, error) {\n\tvar mErr multierror.Error\n\n\t// Check if a config is allowed\n\tif info.configSchema == nil {\n\t\tif info.config != nil {\n\t\t\treturn nil, fmt.Errorf(\"configuration not allowed but config passed\")\n\t\t}\n\n\t\t// Nothing to do\n\t\treturn nil, nil\n\t}\n\n\t// Convert the schema to hcl\n\tspec, diag := hclspecutils.Convert(info.configSchema)\n\tif diag.HasErrors() {\n\t\t_ = multierror.Append(&mErr, diag.Errs()...)\n\t\treturn nil, multierror.Prefix(&mErr, \"failed converting config schema:\")\n\t}\n\n\t// If there is no config, initialize it to an empty map so we can still\n\t// handle defaults\n\tif info.config == nil {\n\t\tinfo.config = map[string]interface{}{}\n\t}","sourceCodeStart":452,"sourceCodeEnd":488,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/helper/pluginutils/loader/init.go#L452-L488","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Remove the config block for that plugin from the agent configuration — the plugin accepts no configuration.","Confirm which plugin the config was intended for and move it to the correct plugin's stanza.","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.","Check for plugin version drift: a downgraded binary may have lost its schema while old config remains."],"exampleFix":"// before (agent config)\nplugin \"my-driver\" {\n  config {\n    endpoint = \"unix:///var/run/foo.sock\"\n  }\n}\n// after (plugin declares no schema — remove config)\nplugin \"my-driver\" {}","handlingStrategy":"validation","validationCode":"// Only pass config if the plugin actually declares a schema\nschema := pluginInfo.ConfigSchema // nil means no config allowed\nif schema == nil && userConfig != nil {\n    return fmt.Errorf(\"plugin %q accepts no config; remove the config block\", pluginName)\n}","typeGuard":"func acceptsConfig(schema *hclspec.Spec) bool { return schema != nil }","tryCatchPattern":"if err := loader.Load(cfg); err != nil {\n    if strings.Contains(err.Error(), \"configuration not allowed but config passed\") {\n        log.Printf(\"removing config for schema-less plugin; retrying without it\")\n        cfg = stripPluginConfig(cfg)\n        return loader.Load(cfg)\n    }\n    return err\n}","preventionTips":["Consult the plugin's documentation for whether it supports a config block before adding one.","After upgrading/downgrading a plugin binary, re-review any leftover config stanzas.","Validate agent config against each plugin's advertised schema in CI."],"tags":["plugin-loader","config-validation","misconfiguration"],"backgroundTag":"unexpected-plugin-configuration","analyzedSha":"482b49bf1aec006f089bcfc7e632d8f6ac303e5e","analyzedAt":"2026-09-04T07:54:14.808Z","contentChangedAt":"2026-09-04T07:54:14.808Z","schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}