{"record":{"id":"d6e126ff61bf0482","repo":"hashicorp/nomad","slug":"configuration-install-failed-w","errorCode":null,"errorMessage":"configuration install failed - %w","messagePattern":"configuration install failed - %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"command/windows_service_install.go","lineNumber":174,"sourceCode":"\t\t\tc.Ui.Output(\"  Stopping existing nomad service\")\n\t\t\tif err := nmdSvc.Stop(); err != nil {\n\t\t\t\treturn fmt.Errorf(\"unable to stop existing service - %w\", err)\n\t\t\t}\n\t\t}\n\t}\n\n\t// Install the nomad binary into the system\n\tif err = c.binaryInstall(opts); err != nil {\n\t\treturn fmt.Errorf(\"binary install failed - %w\", err)\n\t}\n\n\tc.Ui.Output(fmt.Sprintf(\"  Nomad binary installed to: %s\", opts.binaryPath))\n\n\t// Create a configuration directory and add\n\t// a basic configuration file if no configuration\n\t// currently exists\n\tif err = c.configInstall(opts); err != nil {\n\t\treturn fmt.Errorf(\"configuration install failed - %w\", err)\n\t}\n\n\tc.Ui.Output(fmt.Sprintf(\"  Nomad configuration directory: %s\", opts.configDir))\n\tc.Ui.Output(fmt.Sprintf(\"  Nomad agent data directory: %s\", opts.configDir))\n\n\t// Now let's install that service\n\tif err := c.serviceInstall(m, opts); err != nil {\n\t\treturn fmt.Errorf(\"service install failed - %w\", err)\n\t}\n\n\treturn nil\n}\n\nfunc (c *WindowsServiceInstallCommand) serviceInstall(m winsvc.WindowsServiceManager, opts *windowsInstallOpts) error {\n\tvar err error\n\tvar srvc winsvc.WindowsService\n\tcmd := fmt.Sprintf(\"%s agent -config %s\", opts.binaryPath, opts.configDir)\n","sourceCodeStart":156,"sourceCodeEnd":192,"githubUrl":"https://github.com/hashicorp/nomad/blob/482b49bf1aec006f089bcfc7e632d8f6ac303e5e/command/windows_service_install.go#L156-L192","documentation":"performInstall wrapper for configInstall failures: creating the configuration directory or writing the basic config file for the Nomad Windows service failed; the wrapped filesystem error gives the cause.","triggerScenarios":"Creating opts.configDir or writing the default config file fails: path invalid, permission denied, or a file exists where a directory is expected.","commonSituations":"Config dir pointing at a path the user cannot write; an old file occupies the config directory path; group policy or readonly mount blocks creation.","solutions":["Verify the parent path of the config directory exists and is writable from an elevated shell","If -config-dir was given, correct the path (no trailing invalid characters, not a file)","Create the directory manually with correct ACLs, then re-run install","Run the install command as Administrator"],"exampleFix":"// before\nnomad windows install -config-dir C:\\blocked\\nomad\n// after\nnomad windows install -config-dir C:\\ProgramData\\nomad","handlingStrategy":"validation","validationCode":"if fi, err := os.Stat(opts.configDir); err == nil && !fi.IsDir() {\n\tlog.Fatalf(\"%s exists and is not a directory\", opts.configDir)\n}\nif err := os.MkdirAll(opts.configDir, 0o755); err != nil {\n\tlog.Fatalf(\"cannot create config dir: %v\", err)\n}","typeGuard":null,"tryCatchPattern":"if err := c.configInstall(opts); err != nil {\n\tif errors.Is(err, os.ErrPermission) { /* retry elevated */ }\n\treturn fmt.Errorf(\"configuration install failed - %w\", err)\n}","preventionTips":["Verify the -config-dir path is writable by the installing user","Ensure the path is not occupied by a regular file","Pre-create the directory with correct ACLs","Run the installer elevated"],"tags":["windows","filesystem","configuration"],"backgroundTag":"config-directory-creation-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"}