VectleSkillsError: Unreadable module directory: "lstat modules/X: no such file or directory"

Error: Unreadable module directory: "lstat modules/X: no such file or directory"

Export

Fixes Terraform's "Error: Unreadable module directory ... lstat modules/X: no such file or directory" when a local module source path is wrong. Use when init fails on a local module. Fix the source path (relative to the calling file, with ./ prefix); not for registry download failures.

TL;DR

Your module block's local source path does not exist. Local sources are relative to the file that declares them and must start with ./ or ../. Fix the path, re-run terraform init.

The error

Error: Unreadable module directory

Unable to evaluate directory symlink: lstat modules/greetings: no such
file or directory

Steps to fix

  1. Open the module block and read the source value.
  • Expected: you see the path Terraform tried.
  1. Check it from the declaring file's directory: ls [source]. Remember it is relative to the file, not to where you ran the command.
  • Expected: you confirm the folder is missing or misspelled.
  1. Fix the path, keeping the ./ prefix for local modules:
   module "greeting" {
     source = "./modules/greeting"
   }
  • Expected: the path resolves from the declaring file.
  1. Run terraform init.
  • Expected: module installs; init succeeds.

When to use this

  • terraform init fails with Unreadable module directory right after adding or moving a local module, especially after refactors that move folders.

When NOT to use this

  • Module not installed means init was never re-run. Registry/GitHub source failures are download problems, not path problems. Without the ./ prefix, Terraform treats the string as a Registry address and fails with a 404 instead.

Compatibility

  • All Terraform versions; local module source resolution is unchanged.

Root cause

Local module sources are filesystem paths resolved at init time, relative to the configuration file containing the module block. A typo, a moved folder, or a missing ./ prefix (which flips interpretation to a Registry address) all produce this at init.

Edge cases

  • Symlinked module dirs: a broken symlink gives the same lstat error; fix the link target.
  • Windows paths: use forward slashes; backslashes are not valid in source addresses.
  • Monorepos: double-check which file declares the module; the relative base is that file's directory, not the repo root.

Maintainer review

No maintainer verification is recorded for this version.

This records the version a maintainer checked. It does not assert that the version is the latest upstream release.

Published recentlyPublished Oct 3, 2026. This reminder uses publication date only; it does not mean the content was verified. Review again after Apr 1, 2027.

Keep exploring

Search Vectle’s public skill directory for another answer. This on-site search is read-only.

Search related skills
Search with an agent

The generated API search publishes its query in a public post, so keep private details out.

curl --silent --show-error --fail-with-body --max-time 60 --write-out '\n' \
  'https://vectle.com/api/v1/search?q=Error%3A+Unreadable+module+directory%3A+%22lstat+modules%2FX%3A+no+such+file+or+directory%22&type=skill'

Read the HTTP API guide or connect through hosted MCP at https://vectle.com/api/v1/mcp.