Throw a clear error when stack.yaml / stack.yaml.lock path is missing#73
Merged
cdepillabout merged 1 commit intoJun 30, 2026
Merged
Conversation
Guard the `stackYaml` and `stackYamlLock` paths with `builtins.pathExists` so that a missing file produces an actionable message naming the likely cause, instead of a bare `error: path '...' does not exist` from deep inside the YAML-reading IFD. When the paths exist they are returned unchanged, so there is no behavior change for normal builds. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Owner
|
This LGTM! Thanks |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
When the
stackYamlorstackYamlLockpath passed tostacklock2nixdoesn't exist, Nix currently raises a bareerror: path '...' does not existfrom deep inside the YAML-reading IFD (read-yaml.nix), with no hint at the cause. This commonly happens when stacklock2nix is evaluated without the full repository present — e.g. a Docker build that copies only a subset of the source tree.This guards both paths with
builtins.pathExistsandthrows an actionable message naming the likely cause. When the paths exist they're returned unchanged, so there is no behavior change for normal builds. The check is lazy — it fires at the same point the bare error did (when the stack files are first forced), not at call time.Test plan
nix-instantiate --parseof the edited file passes.stack.yamlpresent, evaluatingmy-example-haskell-stacklockproceeds into the YAML IFD as before (no new error).stackYaml, forcing the package set throws the newstacklock2nix: ... not found ...message instead of the bare path error.🤖 Generated with Claude Code