{"record":{"id":"2f70989c6d731dae","repo":"hashicorp/nomad","slug":"cannot-generate-configuration-path-s","errorCode":null,"errorMessage":"cannot generate configuration path - %s","messagePattern":"cannot generate configuration path - (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/windows_service_install.go","lineNumber":258,"sourceCode":"\tif err := srvc.Start(); err != nil {\n\t\treturn fmt.Errorf(\"could not start service - %w\", err)\n\t}\n\n\treturn nil\n}\n\nfunc (c *WindowsServiceInstallCommand) configInstall(opts *windowsInstallOpts) error {\n\t// If the config or data directory are unset, default them\n\tif opts.configDir == \"\" {\n\t\topts.configDir = filepath.Join(winsvc.WINDOWS_INSTALL_APPDATA_DIRECTORY, \"config\")\n\t}\n\tif opts.dataDir == \"\" {\n\t\topts.dataDir = filepath.Join(winsvc.WINDOWS_INSTALL_APPDATA_DIRECTORY, \"data\")\n\t}\n\n\tvar err error\n\tif opts.configDir, err = c.winPaths.Expand(opts.configDir); err != nil {\n\t\treturn fmt.Errorf(\"cannot generate configuration path - %s\", err)\n\t}\n\tif opts.dataDir, err = c.winPaths.Expand(opts.dataDir); err != nil {\n\t\treturn fmt.Errorf(\"cannot generate data path - %s\", err)\n\t}\n\n\t// Ensure directories exist\n\tif err = c.winPaths.CreateDirectory(opts.configDir, true); err != nil {\n\t\treturn fmt.Errorf(\"cannot create configuration directory - %s\", err)\n\t}\n\n\tif err = c.winPaths.CreateDirectory(opts.dataDir, true); err != nil {\n\t\treturn fmt.Errorf(\"cannot create data directory - %s\", err)\n\t}\n\n\t// Check if any configuration files exist\n\tmatches, _ := filepath.Glob(filepath.Join(opts.configDir, \"*\"))\n\tif len(matches) < 1 {\n\t\tf, err := os.Create(filepath.Join(opts.configDir, \"config.hcl\"))","sourceCodeStart":240,"sourceCodeEnd":276,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/windows_service_install.go#L240-L276","documentation":"configInstall expands the user-supplied config directory path (e.g. with %ENV% variables or ~) using c.winPaths.Expand before creating directories. If Expand fails — the path cannot be resolved to an absolute Windows path — this error is returned. It means Nomad could not determine where the configuration should live.","triggerScenarios":"Running 'nomad windows service install' with a -config-dir value that winPaths.Expand cannot resolve: malformed path syntax, an unset environment variable embedded in the path, or an unexpandable prefix.","commonSituations":"Passing '%APPDATA%\\nomad' while the variable is undefined under the service account; using Unix-style ~ or forward slashes on Windows; quoting mistakes leaving literal % characters in the path.","solutions":["Check the wrapped error to see which path failed to expand","Pass a fully-qualified absolute path to -config-dir (e.g. C:\\ProgramData\\nomad)","If using environment variables in the path, verify they are set for the installing user","Omit -config-dir to use the default location"],"exampleFix":"// before\nnomad windows service install -config-dir \"%MY_UNDEFINED_VAR%\\nomad\"\n// after\nnomad windows service install -config-dir \"C:\\ProgramData\\nomad\"","handlingStrategy":"validation","validationCode":"// Validate the config dir is an absolute Windows path before invoking\nif !filepath.IsAbs(configDir) || strings.Contains(configDir, \"%\") || strings.HasPrefix(configDir, \"~\") {\n    return errors.New(\"config-dir must be a fully-qualified absolute Windows path\")\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Always pass absolute Windows paths to -config-dir","Avoid environment-variable placeholders in custom paths","Quote paths correctly in your shell to prevent literal % characters","Use the default location when unsure"],"tags":["windows","configuration","path"],"backgroundTag":"path-resolution-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"}