–– Pkl Error ––
Resource URI `file:../path/.manifest.yml` has invalid syntax.
30 | const manifest = yamlParser.parse(read("file:../\(manifestPath)"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at Common#manifest (file:///pkl/Common.pkl, line 30)
File URIs must have a path that starts with `/` (e.g. file:/path/to/my_module.pkl).
To resolve relative paths, remove the scheme prefix (remove "file:").
However, read requires a Resource which mandates the file: prefix.
Originally created by @BenFradet on GitHub (Oct 24, 2025).
with 0.29, opaque uris are invalid: https://pkl-lang.org/main/current/release-notes/0.29.html#opaque-file-uris-are-invalid
the error message says:
```
–– Pkl Error ––
Resource URI `file:../path/.manifest.yml` has invalid syntax.
30 | const manifest = yamlParser.parse(read("file:../\(manifestPath)"))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
at Common#manifest (file:///pkl/Common.pkl, line 30)
File URIs must have a path that starts with `/` (e.g. file:/path/to/my_module.pkl).
To resolve relative paths, remove the scheme prefix (remove "file:").
```
However, `read` requires a [`Resource`](https://pkl-lang.org/main/current/language-reference/index.html#resources) which mandates the `file:` prefix.
It is a bit awkward to do
```
const workingDirectory = read("env:PWD")
const manifest = yamlParser.parse(read("file:\(workingDirectory)/../\(manifestPath)"))
```
Are there any alternatives?
@bioball commented on GitHub (Oct 24, 2025):
Is that resource at a relative path to your Pkl file? If so, you'd just pass in the relative path:
```pkl
const manifest = yamlParser.parse(read("../\(manifestPath)"))
```
@HT154 commented on GitHub (Oct 24, 2025):
If you do truly want to read relative to the working directory, here's how to do it in a robust, cross-platform way:
https://github.com/apple/pkl-pantry/blob/7a8db5d291bd91b0a1cd0fcc3e6284a167968abf/packages/k8s.contrib.crd/generate.pkl#L98-L107
@BenFradet commented on GitHub (Oct 27, 2025):
> Is that resource at a relative path to your Pkl file? If so, you'd just pass in the relative path:
>
> const manifest = yamlParser.parse(read("../\(manifestPath)"))
this doesn't work, it fails with:
```
–– Pkl Error ––
Cannot find resource `../path/manifest.yml`.
```
The prefix in [Resource](https://pkl-lang.org/main/current/language-reference/index.html#resources) might me mandatory?
It is not. Reading with relative path reads relative to the module the read is in. If you are intending to read relative to the working directory, you need to use the more verbose invocation I linked above.
@HT154 commented on GitHub (Oct 27, 2025):
> The prefix in Resource might me mandatory?
It is not. Reading with relative path reads relative to the module the `read` is in. If you are intending to read relative to the working directory, you need to use the more verbose invocation I linked above.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.
Originally created by @BenFradet on GitHub (Oct 24, 2025).
with 0.29, opaque uris are invalid: https://pkl-lang.org/main/current/release-notes/0.29.html#opaque-file-uris-are-invalid
the error message says:
However,
readrequires aResourcewhich mandates thefile:prefix.It is a bit awkward to do
Are there any alternatives?
@bioball commented on GitHub (Oct 24, 2025):
Is that resource at a relative path to your Pkl file? If so, you'd just pass in the relative path:
@HT154 commented on GitHub (Oct 24, 2025):
If you do truly want to read relative to the working directory, here's how to do it in a robust, cross-platform way:
https://github.com/apple/pkl-pantry/blob/7a8db5d291bd91b0a1cd0fcc3e6284a167968abf/packages/k8s.contrib.crd/generate.pkl#L98-L107
@BenFradet commented on GitHub (Oct 27, 2025):
this doesn't work, it fails with:
The prefix in Resource might me mandatory?
@HT154 commented on GitHub (Oct 27, 2025):
It is not. Reading with relative path reads relative to the module the
readis in. If you are intending to read relative to the working directory, you need to use the more verbose invocation I linked above.