{"record":{"id":"7c686b1c50b78c4a","repo":"temporalio/temporal","slug":"could-not-load-config-file-w","errorCode":null,"errorMessage":"could not load config file: %w","messagePattern":"could not load config file: %w","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"temporal/server_options.go","lineNumber":115,"sourceCode":"\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\n\t}\n\tcfg, err := config.Load(\n\t\tconfig.WithEnv(so.env),\n\t\tconfig.WithConfigDir(so.configDir),\n\t\tconfig.WithZone(so.zone),\n\t)\n\tif err != nil {\n\t\treturn fmt.Errorf(\"could not load config file: %w\", err)\n\t}\n\tso.config = cfg\n\treturn nil\n}\n\nfunc (so *serverOptions) validateConfig() error {\n\tif err := so.config.Validate(); err != nil {","sourceCodeStart":97,"sourceCodeEnd":133,"githubUrl":"https://github.com/temporalio/temporal/blob/bde624efd13fbd3843654058db6d9c716166318b/temporal/server_options.go#L97-L133","documentation":"Returned by serverOptions.loadConfig in temporal/server_options.go:115 when config.Load(WithConfigFile(...)) fails to load an explicit config file path. This wrapper is in turn wrapped by 'unable to load config'. Causes include unreadable file, YAML parse errors, or missing required top-level config sections.","triggerScenarios":"Using temporal.WithConfigFilePath(path) with the temporal server options where path is nonexistent, unreadable (permissions), not valid YAML, or semantically incomplete per config.Load's requirements.","commonSituations":"Absolute path typo, Docker/K8s volume not mounted, file copied without the expected schema, YAML indentation errors, or using a config file from an incompatible Temporal version.","solutions":["Confirm the file exists and is readable by the process user (ls -l / permissions).","Validate the YAML parses (e.g. yamllint) and matches the temporal server config schema.","Check the innermost wrapped error from config.Load for the precise failure (parse vs missing key).","If you only need to override part of the config, consider configDir+env layout instead of a single explicit file."],"exampleFix":"// before\nso := opts; // WithConfigFilePath(\"config.yaml\") relative to a different working dir\n// after\ntemporal.WithConfigFilePath(\"/absolute/path/to/config.yaml\") // always use absolute paths in services","handlingStrategy":"validation","validationCode":"path := so.configFilePath\ninfo, err := os.Stat(path)\nif err != nil || info.IsDir() {\n    return fmt.Errorf(\"config file %q not readable\", path)\n}\nif err := yaml.Unmarshal([]byte(mustRead(path)), &map[string]any{}); err != nil {\n    return fmt.Errorf(\"config file %q is not valid YAML: %w\", path, err)\n}","typeGuard":null,"tryCatchPattern":"if err := cfgLoaded(); err != nil {\n    if errors.Is(err, os.ErrNotExist) {\n        log.Fatalf(\"config file missing: %v\", err)\n    }\n    return err\n}","preventionTips":["Check file existence and readability at service entrypoint before NewServer.","Use absolute paths and verify volumes are mounted in K8s/Docker.","Lint YAML in CI to catch syntax errors before deploy."],"tags":["go","config","yaml","file-not-found"],"backgroundTag":"config-file-not-found","analyzedSha":"bde624efd13fbd3843654058db6d9c716166318b","analyzedAt":"2026-09-01T07:18:39.080Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T10:18:20.063Z"}