Hacktoberfest 2026: the issues maintainers tagged for October, open and beginner-friendly. Browse Hacktoberfest issues

`fold`ing Effectful `Path` crashes at runtime

Open
#481 0 comments 0 reactions 0 assignees View on GitHub

Maintainers usually reply within 1 day

Nobody has claimed this yet.

Assessment

Difficulty
4/5
Estimated time
3-5 days
Newbie friendliness
45/100
Issue type
Bug
Clarity
Mostly clear
Activity status
Active
Domain
cli

Research direction

Start by running the linked BUG-006 reproduction with the Roc code shown in the issue, focusing on the effectful Path.join fold and the Path.is_dir! call. Trace the runtime dispatch that produces the crash. Done means the relative-path example completes without a runtime crash and returns the expected Ok({}) result.

Written by the indexing model from the issue text.

Description

This contrived code should check if a relative path is a directory. e.g. if I passed in ./repro ., there'd be no / and I'd just expect it to return Ok({}). Instead, it builds just fine but then crashes at runtime with: [ROC CRASHED] dispatch on a value that can never exist.

Full easy reproduction (AI genn'ed, but I tested) here

app [main!] {
    pf: platform "https://github.com/roc-lang/basic-cli/releases/download/0.22.0/F1JVZPYfWP71s8vk6tHcV1Qx1Ef6CZkwswGoCn8VHZmL.tar.zst",
}

import pf.OsStr
import pf.Path

require! = |root, relative| {
    path = relative.split_on("/").fold(root, Path.join)
    is_dir = Path.is_dir!(path)?
    if is_dir Ok({}) else Err(Missing(relative))
}

main! = |args|
    match args.drop_first(1).map(OsStr.display) {
        [text] => require!(Path.utf8(text), "")
        _ => Err(BadArgs)
    }
Dominant language
Rust
Stars
121
Forks
46
Avg merge
20h 53m
Merged PRs (30d)
11

Getting set up

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from roc-lang/basic-cli

All issues in roc-lang/basic-cli

Similar issues

More Rust issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.