Call to function "find_in_parent_folders" failed: ParentFileNotFoundError
Fixes Terragrunt's 'Call to function find_in_parent_folders failed: ParentFileNotFoundError' by pointing the lookup at an ancestor or reading siblings relatively. Use when find_in_parent_folders targets a file in the same directory. Not for genuinely missing shared configs.
TL;DR: find_in_parent_folders searches strictly UPWARD, never in the config's own directory. If the file sits beside the referencing config (a sibling, not an ancestor), the lookup traverses to the filesystem root and fails. Read siblings with a relative path instead.
ERROR Call to function "find_in_parent_folders" failed: ParentFileNotFoundError:
ERROR Could not find a _environment.hcl in any of the parent folders of
ERROR .../terraform/modules/applications/[app]/[module]/terragrunt.hcl.
ERROR Cause: Traversed all the way to the root..Steps
- Check where the target file actually lives relative to the referencing config.
Expected: it's a sibling (same directory) or the referencing config is a non-unit template that shouldn't be parsed at all.
- For a sibling, read it relatively:
locals {
env = read_terragrunt_config("env.hcl")
} A relative path resolves against the config file's own directory, so it holds wherever the command runs from. Expected: no find_in_parent_folders for sibling files.
- For ancestors, keep
find_in_parent_folders("name.hcl").
Expected: the lookup finds the file in a parent directory.
- If the failure comes from discovery walking into non-unit template dirs, exclude those dirs from discovery or give them no parseable unit config.
Expected: run --all no longer descends into templates.
When this applies
ParentFileNotFoundErrornaming a file that exists, but as a sibling of the referencing config.- Discovery (
run --all, stack operations) failing inside shared module template directories.
When it doesn't apply
- The file is genuinely missing from all parents: create it or fix the name.
Include configuration not found: that's anincludepath problem, different fix.
Tool versions
All Terragrunt 1.x (rule verified on 1.1.3).
Why it happens
The function starts at the PARENT of the referencing config and walks up. A sibling is never a parent, so the walk reaches the filesystem root and reports ParentFileNotFoundError. The idiom is usually copied from a root include, where upward search is correct.
Edge cases
get_terragrunt_dir()-anchored absolute paths ("${get_terragrunt_dir()}/env.hcl") are the explicit equivalent for siblings.find_in_parent_folders("name.hcl", "fallback.hcl")with a fallback only helps when the file is missing, not when it's a sibling.
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.