{"record":{"id":"52cf78a35c521d66","repo":"hashicorp/nomad","slug":"unable-to-create-executor-config-v","errorCode":null,"errorMessage":"unable to create executor config: %v","messagePattern":"unable to create executor config: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"drivers/shared/executor/utils.go","lineNumber":41,"sourceCode":"\t// searching for an available port\n\tExecutorDefaultMaxPort = 14512\n\n\t// ExecutorDefaultMinPort is the default min port used by the executor for\n\t// searching for an available port\n\tExecutorDefaultMinPort = 14000\n)\n\n// CreateExecutor launches an executor plugin and returns an instance of the\n// Executor interface\nfunc CreateExecutor(\n\tlogger hclog.Logger,\n\tdriverConfig *base.ClientDriverConfig,\n\texecutorConfig *ExecutorConfig,\n) (Executor, *plugin.Client, error) {\n\n\tc, err := json.Marshal(executorConfig)\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"unable to create executor config: %v\", err)\n\t}\n\tbin, err := os.Executable()\n\tif err != nil {\n\t\treturn nil, nil, fmt.Errorf(\"unable to find the nomad binary: %v\", err)\n\t}\n\n\tp := &ExecutorPlugin{\n\t\tlogger:      logger,\n\t\tfsIsolation: executorConfig.FSIsolation,\n\t\tcompute:     driverConfig.Topology.Compute(),\n\t}\n\n\tconfig := &plugin.ClientConfig{\n\t\tHandshakeConfig:  base.Handshake,\n\t\tPlugins:          map[string]plugin.Plugin{\"executor\": p},\n\t\tCmd:              exec.Command(bin, \"executor\", string(c)),\n\t\tAllowedProtocols: []plugin.Protocol{plugin.ProtocolGRPC},\n\t\tLogger:           logger.Named(\"executor\"),","sourceCodeStart":23,"sourceCodeEnd":59,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/drivers/shared/executor/utils.go#L23-L59","documentation":"CreateExecutor launches the executor as a Nomad executor plugin subprocess and must serialize the ExecutorConfig to JSON to pass it to the child. This error wraps a json.Marshal failure of *ExecutorConfig, meaning the config could not be encoded (e.g. unsupported field types such as channels, funcs, or custom marshaling errors).","triggerScenarios":"Calling executor.CreateExecutor with an ExecutorConfig containing fields that json.Marshal cannot encode (function values, channels, cyclic structures, or a custom MarshalJSON that errors).","commonSituations":"Driver authors embedding non-serializable values into ExecutorConfig custom fields; version drift where a config struct gained an unserializable field; mismanaged struct tags on forked configs.","solutions":["Inspect the wrapped %v cause to find the offending field type","Remove or pre-convert unserializable fields (funcs, channels) in the ExecutorConfig before calling CreateExecutor","Add valid json tags and ensure all embedded types implement correct JSON encoding","Test config serialization in unit tests before launching the executor plugin"],"exampleFix":"// before\ncfg.FSIsolation = someFuncValue // unserializable\nexec, _, _ := CreateExecutor(logger, driverCfg, cfg)\n// after\ncfg.IsolationKind = \"chroot\" // serializable string\nexec, _, err := CreateExecutor(logger, driverCfg, cfg)","handlingStrategy":"validation","validationCode":"if _, err := json.Marshal(executorConfig); err != nil { fix config fields before CreateExecutor }","typeGuard":null,"tryCatchPattern":"exec, _, err := executor.CreateExecutor(logger, drvCfg, cfg)\nif err != nil && strings.Contains(err.Error(), \"unable to create executor config\") {\n    return fmt.Errorf(\"config not serializable: %w\", err)\n}","preventionTips":["Keep ExecutorConfig JSON-serializable (no funcs/channels)","Unit-test config marshaling before plugin launch","Use json tags on all config fields"],"tags":["json","serialization","executor-plugin"],"backgroundTag":"json-marshal-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"}