{"record":{"id":"a03665aa88210eac","repo":"hashicorp/terraform","slug":"error-checking-configuration-s","errorCode":null,"errorMessage":"Error checking configuration: %s","messagePattern":"Error checking configuration: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/command/init_run.go","lineNumber":108,"sourceCode":"\n\t\tinitDirFromModuleAbort, initDirFromModuleDiags := c.initDirFromModule(ctx, path, src, hooks)\n\t\tdiags = diags.Append(initDirFromModuleDiags)\n\t\tif initDirFromModuleAbort || initDirFromModuleDiags.HasErrors() {\n\t\t\tview.Diagnostics(diags)\n\t\t\tspan.SetStatus(codes.Error, \"module installation failed\")\n\t\t\tspan.End()\n\t\t\treturn 1\n\t\t}\n\t\tspan.End()\n\n\t\tview.Spacer()\n\t}\n\n\t// If our directory is empty, then we're done. We can't get or set up\n\t// the backend with an empty directory.\n\tempty, err := configs.IsEmptyDir(path, initArgs.TestsDirectory)\n\tif err != nil {\n\t\tdiags = diags.Append(fmt.Errorf(\"Error checking configuration: %s\", err))\n\t\tview.Diagnostics(diags)\n\t\treturn 1\n\t}\n\tif empty {\n\t\tview.Output(views.OutputInitEmptyMessage)\n\t\treturn 0\n\t}\n\n\t// Load just the root module to begin backend and module initialization\n\trootModEarly, earlyConfDiags := c.loadSingleModuleWithTests(path, initArgs.TestsDirectory)\n\n\t// There may be parsing errors in config loading but these will be shown later _after_\n\t// checking for core version requirement errors. Not meeting the version requirement should\n\t// be the first error displayed if that is an issue, but other operations are required\n\t// before being able to check core version requirements.\n\tif rootModEarly == nil {\n\t\tdiags = diags.Append(errors.New(errInitConfigError), earlyConfDiags)\n\t\tview.Diagnostics(diags)","sourceCodeStart":90,"sourceCodeEnd":126,"githubUrl":"https://github.com/hashicorp/terraform/blob/c9def3e214014c1188faabfc4a5bde5095139765/internal/command/init_run.go#L90-L126","documentation":"Emitted by InitCommand.run when configs.IsEmptyDir(path, testsDir) errors while checking whether the working directory contains any configuration (init_run.go:106-108). This check gates the rest of init: if it cannot determine emptiness, init aborts before loading config. The %s is the underlying IsEmptyDir error.","triggerScenarios":"Running `terraform init` in a working directory that exists but where Terraform cannot walk/stat its contents: permission denied on the dir or a child entry, I/O errors, broken symlinks, or the test directory argument (-test-directory) points somewhere unreadable.","commonSituations":"Read-only or foreign-owned working directories; .terraform/.tftest directories created by root; corporate mount permission issues; full/ failing disks; misconfigured -test-directory pointing at an inaccessible path.","solutions":["Make the working directory (and any -test-directory) readable+traversable by the terraform user.","Fix or remove broken symlinks and stale .terraform artifacts.","Confirm the test directory passed to -test-directory exists and is readable.","Restore the underlying filesystem to a healthy state and retry init."],"exampleFix":"# before\n$ terraform init   # cwd not stat-able\n# after\n$ chmod a+rx .\n$ terraform init","handlingStrategy":"validation","validationCode":"// Confirm the working dir and test dir are stat-able before init.\nfor _, d := range []string{wd, testDir} {\n    if _, err := os.Stat(d); err != nil {\n        return fmt.Errorf(\"cannot stat %q: %w\", d, err)\n    }\n}","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Run init in a working directory the terraform user can read and traverse.","Make sure -test-directory points to an existing, readable path.","Avoid running init against directories with broken symlinks or on failing mounts."],"tags":["terraform-init","filesystem","permissions","working-directory"],"analyzedSha":"c9def3e214014c1188faabfc4a5bde5095139765","analyzedAt":"2026-08-07T15:39:49.278Z","schemaVersion":2},"datasetVersion":"2026-08-07T20:17:04.800Z"}