Skip to content

moon check fails for a valid .mbtx script when the script is placed inside a MoonBit project directory #1506

@myfreess

Description

@myfreess

Actual behavior

# check find_if_is_some.mbtx under moonbit-community/moongrep-guide
moon check find_if_is_some.mbtx
 WARN Duplicate alias `test` at "/home/foo/works/moongrep-guide/.mooncakes/moonbitlang/yacc/src/lib/parser/test/moon.pkg". "test-import" will automatically add "import" and current package as dependency so you don't need to add it manually. If you're test-importing a dependency with the same default alias as your current package, considering give it a different alias than the current package. Violating import: `moonbitlang/core/test`
error: Failed to calculate build plan

Caused by:
    Cannot find package to build based on input path `/home/foo/works/moongrep-guide`.
    Hint: The provided path `/home/foo/works/moongrep-guide` is inside the packages directory of module `moonbit-community/moongrep-guide` at `/home/foo/works/moongrep-guide/`,
                but does not match any known package.

Expected Behavior

moon check should successfully check the .mbtx script as long as the script itself is valid, regardless of whether it is located inside a MoonBit project directory.

Steps to Reproduce

Create a MoonBit project:

moon new foo
cd foo
touch foo.mbtx
echo "fn main {}" > foo.mbtx
rm moon.pkg
rm *.mbt
moon check foo.mbtx

Environment

Operating System: Linux

moon 0.1.20260306 (f38fe7c 2026-03-06) ~/.moon/bin/moon
moonc v0.8.3+de5b7a281 (2026-03-06) ~/.moon/bin/moonc
moonrun 0.1.20260306 (f38fe7c 2026-03-06) ~/.moon/bin/moonrun

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpending-triageThis issue is not confirmed yet, and/or hasn't been checked for priority

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions