Terragrunt error - Error in function call; Call to function "get_repo_root" failed:
Last updated: November 10, 2024
Issue: Error in function call; Call to function "get_repo_root" failed
This error occurs in Spacelift when Terragrunt tries to use the get_repo_root function. By default, Spacelift does not use Git to check out your code; instead, it downloads an archive directly from the Version Control System (VCS). This can cause errors with functions that require a Git repository structure.
Solution for GitHub Users
If you are using GitHub as your VCS provider, you can enable Git checkout functionality for your stack by adding a special label.
Add the Magic Label
Add the labelfeature:enable_git_checkoutto your stack. This enables Git checkout, allowing Terragrunt to use theget_repo_rootfunction without issues.Run Again
After adding the label, retry the run to ensure the error is resolved.
For more information, refer to Spacelift's documentation on Git checkout support for GitHub.
Solution for Other VCS Providers
If you are using a VCS provider other than GitHub, please contact Spacelift Support to enable Git checkout for your account. Our support team can assist you in configuring this feature to ensure compatibility with functions like get_repo_root.