{"record":{"id":"757e8d7d5a1d51a4","repo":"hashicorp/terraform","slug":"there-is-no-configuration-directory-at-s","errorCode":null,"errorMessage":"There is no configuration directory at %s","messagePattern":"There is no configuration directory at (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/fmt.go","lineNumber":239,"sourceCode":"\t\t_, err = w.Write(result)\n\t\tif err != nil {\n\t\t\tdiags = diags.Append(fmt.Errorf(\"Failed to write result\"))\n\t\t}\n\t}\n\n\treturn diags\n}\n\nfunc (c *FmtCommand) processDir(path string, stdout io.Writer) tfdiags.Diagnostics {\n\tvar diags tfdiags.Diagnostics\n\n\tlog.Printf(\"[TRACE] terraform fmt: looking for files in %s\", path)\n\n\tentries, err := os.ReadDir(path)\n\tif err != nil {\n\t\tswitch {\n\t\tcase os.IsNotExist(err):\n\t\t\tdiags = diags.Append(fmt.Errorf(\"There is no configuration directory at %s\", path))\n\t\tdefault:\n\t\t\t// ReadDir does not produce error messages that are end-user-appropriate,\n\t\t\t// so we'll need to simplify here.\n\t\t\tdiags = diags.Append(fmt.Errorf(\"Cannot read directory %s\", path))\n\t\t}\n\t\treturn diags\n\t}\n\n\tfor _, info := range entries {\n\t\tname := info.Name()\n\t\tif configs.IsIgnoredFile(name) {\n\t\t\tcontinue\n\t\t}\n\t\tsubPath := filepath.Join(path, name)\n\t\tif info.IsDir() {\n\t\t\tif c.recursive {\n\t\t\t\tsubDiags := c.processDir(subPath, stdout)\n\t\t\t\tdiags = diags.Append(subDiags)","sourceCodeStart":221,"sourceCodeEnd":257,"githubUrl":"https://github.com/hashicorp/terraform/blob/d32a084675427f5ac3f7d2868578ef8b2c1dc525/internal/command/fmt.go#L221-L257","documentation":"Thrown by processDir when os.ReadDir returns an error matching os.IsNotExist — the target directory path does not exist on disk. Used during recursive directory processing in `terraform fmt`.","triggerScenarios":"Passing a directory path that does not exist; a subdirectory removed between stat and readdir; typo in the path argument; running fmt from the wrong working directory.","commonSituations":"Typo'd module path; running `terraform fmt ./mymodule` from a parent dir where ./mymodule does not exist; path with a stale symlink pointing to a removed target.","solutions":["Verify the directory exists: `ls -ld <path>`.","Check for typos and correct the path argument.","If using a symlink, ensure its target exists (`readlink -f <path>`)."],"exampleFix":null,"handlingStrategy":"validation","validationCode":"// Verify a directory exists before passing it to fmt.\nfunc dirExists(p string) bool {\n    fi, err := os.Stat(p)\n    return err == nil && fi.IsDir()\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Resolve and validate directory paths before invoking fmt.","Validate symlinks with readlink -f to detect stale targets.","Run fmt from the correct working directory."],"tags":["terraform-fmt","filesystem","directory-not-found","path"],"backgroundTag":null,"analyzedSha":"d32a084675427f5ac3f7d2868578ef8b2c1dc525","analyzedAt":"2026-08-11T18:43:52.779Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}