{"record":{"id":"39307f91f02d7492","repo":"temporalio/temporal","slug":"config-validation-error-w","errorCode":null,"errorMessage":"config validation error: %w","messagePattern":"config validation error: %w","errorType":"validation","errorClass":null,"httpStatus":null,"severity":"error","filePath":"temporal/server_options.go","lineNumber":100,"sourceCode":"}\n\nfunc (so *serverOptions) loadAndValidate() error {\n\tfor serviceName := range so.serviceNames {\n\t\tif !slices.Contains(Services, string(serviceName)) {\n\t\t\treturn fmt.Errorf(\"invalid service %q in service list %v\", serviceName, so.serviceNames)\n\t\t}\n\t}\n\n\tif so.config == nil {\n\t\terr := so.loadConfig()\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"unable to load config: %w\", err)\n\t\t}\n\t}\n\n\terr := so.validateConfig()\n\tif err != nil {\n\t\treturn fmt.Errorf(\"config validation error: %w\", err)\n\t}\n\n\treturn nil\n}\n\nfunc (so *serverOptions) loadConfig() error {\n\tif so.configFilePath != \"\" {\n\t\tif so.env != \"\" || so.configDir != \"\" || so.zone != \"\" {\n\t\t\treturn errors.New(\"env, config, zone can not be set if configFilePath is set\")\n\t\t}\n\t\tcfg, err := config.Load(\n\t\t\tconfig.WithConfigFile(so.configFilePath),\n\t\t)\n\t\tif err != nil {\n\t\t\treturn fmt.Errorf(\"could not load config file: %w\", err)\n\t\t}\n\t\tso.config = cfg\n\t\treturn nil","sourceCodeStart":82,"sourceCodeEnd":118,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/temporal/server_options.go#L82-L118","documentation":"Returned by serverOptions.loadAndValidate in temporal/server_options.go:100 when the loaded config fails validation. Wrapping covers two sources: config.Config.Validate() failures (structural/semantic checks on persistence, services, etc.) and the check that every requested service name exists in config.Services. The server refuses to start with an internally inconsistent configuration even if the YAML parsed successfully.","triggerScenarios":"temporal.NewServer(...) after config loads OK but: (a) Config.Validate() rejects the config (e.g. missing persistence setup, invalid DB config), or (b) a service requested via temporal.WithFrontendService/WithHistoryService/WithMatchingService/WithWorkerService/WithService (or DefaultsServiceNames) is absent from the 'services' section of the config file.","commonSituations":"Trimmed-down config files that omit a service section while the server was asked to run that service; upgrading Temporal and the config no longer satisfying new Validate() rules; hand-edited YAML where a services entry was renamed or deleted.","solutions":["Read the wrapped cause: if it names a service, add that service under the 'services' key of your config (or drop it from the requested service list via ServerOption).","If the cause is from Config.Validate(), fix the specific field it reports (commonly persistence/datastores or global settings).","Compare your config against the upstream config_template.yaml for the same Temporal version to find missing required sections.","Ensure the services map in config has an entry for each of frontend, history, matching, worker that your server options request."],"exampleFix":"// config.yaml before — worker requested by options but missing\nservices:\n  frontend:\n    rpc:\n      grpcPort: 7233\n  history:\n    rpc:\n      grpcPort: 7234\n// after — added the missing service block\nservices:\n  frontend:\n    rpc:\n      grpcPort: 7233\n  history:\n    rpc:\n      grpcPort: 7234\n  worker:\n    rpc:\n      grpcPort: 7239","handlingStrategy":"validation","validationCode":"// Pre-check every requested service exists in the config's services map\nfor _, svc := range []string{\"frontend\", \"history\", \"matching\", \"worker\"} {\n    if _, ok := cfg.Services[svc]; !ok {\n        return fmt.Errorf(\"service %q missing from config services map\", svc)\n    }\n}","typeGuard":null,"tryCatchPattern":"if err := server.Start(); err != nil {\n    if strings.Contains(err.Error(), \"config validation error\") {\n        log.Fatalf(\"invalid config: %v\", err)\n    }\n    return err\n}","preventionTips":["Keep the services section of your config in sync with the services your server options request.","Diff your config against config_template.yaml when upgrading Temporal versions.","Run config.Validate()-equivalent checks in a preflight/CI step before deployment."],"tags":["go","config","validation","temporal-server"],"backgroundTag":"invalid-config-value","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}