{"record":{"id":"95e74cdd44b45007","repo":"hashicorp/nomad","slug":"failed-to-parse-config-95e74c","errorCode":null,"errorMessage":"failed to parse config: ","messagePattern":"failed to parse config: ","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"plugins/shared/cmd/launcher/command/device.go","lineNumber":198,"sourceCode":"\t\tfor _, err := range diag.Errs() {\n\t\t\terrStr = fmt.Sprintf(\"%s\\n* %s\", errStr, err.Error())\n\t\t}\n\t\treturn nil, errors.New(errStr)\n\t}\n\n\treturn schema, nil\n}\n\nfunc (c *Device) setConfig(spec hcldec.Spec, apiVersion string, config []byte, nmdCfg *base.AgentConfig) error {\n\t// Parse the config into hcl\n\tconfigVal, err := hclConfigToAny(config)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\tval, diag, diagErrs := hclutils.ParseHclInterface(configVal, spec, nil)\n\tif diag.HasErrors() {\n\t\treturn multierror.Append(errors.New(\"failed to parse config: \"), diagErrs...)\n\t}\n\n\tcdata, err := msgpack.Marshal(val, val.Type())\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treq := &base.Config{\n\t\tPluginConfig: cdata,\n\t\tAgentConfig:  nmdCfg,\n\t\tApiVersion:   apiVersion,\n\t}\n\n\tif err := c.dev.SetConfig(req); err != nil {\n\t\treturn err\n\t}\n\n\treturn nil","sourceCodeStart":180,"sourceCodeEnd":216,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/plugins/shared/cmd/launcher/command/device.go#L180-L216","documentation":"In plugins/shared/cmd/launcher/command/device.go:198 (setConfig, called by Run), after obtaining the schema the launcher parses the submitted plugin configuration (hclutils.ParseHclInterface). If HCL diagnostics have errors, it returns multierror with the prefix 'failed to parse config: ' plus each parse error. It means the user-supplied device plugin config does not conform to the plugin's declared schema.","triggerScenarios":"Providing a device plugin config block whose HCL fails to decode: wrong value types (string where number expected), unknown attributes not allowed by the schema, or malformed HCL syntax in the config blob passed to the launcher.","commonSituations":"Typo'd keys in plugin config stanzas in the Nomad client config; passing JSON-as-HCL with wrong types; version drift where a plugin expects new config fields and old configs reference removed ones.","solutions":["Fix the config per the appended diagnostics: correct types, remove unknown keys, fix HCL syntax","Check the plugin's documentation for its expected config schema","Test the config against the plugin schema with nomad agent -config validation before startup"],"exampleFix":"// before\nconfig {\n  enabled = \"yes\"   # wrong type\n  unknow_key = 1    # unknown attribute\n}\n// after\nconfig {\n  enabled = true\n}","handlingStrategy":"validation","validationCode":"// validate plugin config HCL against the schema before startup\nval, diag, _ := hclutils.ParseHclInterface(cfg, spec, nil)\nif diag.HasErrors() { return fmt.Errorf(\"config invalid: %v\", diag.Errs()) }","typeGuard":null,"tryCatchPattern":"if err := c.setConfig(spec, apiVer, cfg, agentCfg); err != nil {\n    return fmt.Errorf(\"device plugin config rejected: %w\", err)\n}","preventionTips":["Match plugin config exactly to the plugin's documented schema","Type-check values (booleans vs strings) in client config","After plugin upgrades, re-validate existing config stanzas"],"tags":["device-plugin","hcl","config","launcher"],"backgroundTag":"config-parse-failed","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"}