This guide is a short checklist for common hew compiler, CLI, and source-build failures.
Start with the smallest command that still reproduces the problem:
hew check path/to/main.hew
hew build path/to/main.hew -o app
hew run path/to/main.hewFor multi-file compile/typecheck flows, hew check, hew build, and hew run
operate on a single entry-point file and resolve imports recursively from
there. Pass main.hew (or your real top-level entry file), not every file in
the tree.
For the standard bootstrap flow, start with adze init <name> so you get
hew.toml, main.hew, and .gitignore, then begin with
hew check main.hew / hew run main.hew. hew init remains the lighter
source-only scaffold: it writes main.hew plus README.md, but no
hew.toml.
Common signs:
Error: clang not found. Install LLVM to link Hew programs.- raw linker output after
hew build <file.hew> [-o output] hew check <file.hew>succeeds, buthew build ...orhew run ...fails
What to check:
- Use
hew check <file.hew>first to separate frontend failures from link/toolchain failures. - Hew forwards raw linker output. Fix missing libraries, bad
--link-libflags, or target mismatches before chasing compiler internals. - For this repo, use
make,make release,make test, and other Makefile targets instead of calling Cargo/CMake/ctest directly. - Use the toolchain from the root README: Rust stable, LLVM/MLIR 22, CMake >= 3.20, Ninja, and clang/clang++.
- On Linux, build the embedded codegen with clang/clang++ rather than GCC
(see
cross-platform-build-guide.mdfor the reason — LLVM CMake config propagates Clang-specific warning flags that GCC does not accept). - On macOS, use Homebrew LLVM (
LLVM_PREFIX="$(brew --prefix llvm)") and followcross-platform-build-guide.mdfor bitcode, sysroot, and libc++ issues. - After switching LLVM installs,
CC/CXX, orHEW_STATIC, runmake cleanbefore rebuilding. - If the program builds but you need a debugger, use
hew debug <file.hew> [-- args...].
Common signs:
- a
type mismatcherror such asexpected int, found String cannot infer typereturn type mismatch: expected ..., found ...
What to check:
- Start with
hew check <file.hew>. - While iterating on the same file or directory,
hew watch <file_or_dir>can keep rerunning checks automatically on every save — see Watch mode below. - Add explicit types to function parameters, return values, locals flowing into
generic code, and any
_placeholders. type Foo = _;currently fails closed withcannot infer type for type aliasand a help suggestion to add a type annotation.fn ... -> _and trait default methods with bodies and-> _fail closed too: if the checker cannot resolve a concrete return type, Hew reports an inference error at the checker/output boundary instead of guessing later in serialization or codegen.- When you hit a mismatch, fix the earliest ambiguous binding or return value, not only the final call site.
Common signs:
- a module-not-found error for a local or package module
- a
cannot resolve import ...diagnostic - an
unused import: ...warning while reorganizing imports
What to check:
-
Run
hew check <file.hew>orhew build <file.hew> [-o output]against the real entry file, not a peer file inside a module directory. -
For
import greeting;, Hew looks forgreeting.hewbeside the importer orgreeting/greeting.hewin a directory-form module. The entry file stem must match the directory name. -
Other top-level
.hewfiles in that directory merge into the same module automatically. Subdirectories do not; import child modules explicitly, for exampleimport text_stats::words;. -
Standard library imports are available under the last path segment:
import std::fs;givesfs, andimport std::encoding::json;givesjson. -
Search roots are tried in this exact order, first match wins:
HEWPATH(colon-separated entries; each entry is the parent directory ofstd/)HEW_STD(the path tostd/itself; Hew uses its parent as the search root)- the installed
<prefix>/share/hewtree relative to thehewbinary - a development fallback to the repo root when
std/exists two levels above the binary
-
hew.tomldoes not configure module search paths. UseHEWPATHorHEW_STDwhen you need Hew to look in a non-default module root. -
If the missing module is a package dependency, run
adze install. If it is undeclared in project metadata, add it withadze add ...first. -
Use the candidate-path list in the module-not-found error to confirm where Hew actually looked.
-
import mod::*;works, but wildcard imports currently can emit a false-positiveunused importwarning when the module is only used through type references. Prefer bare (import mod;) or selective (import mod::{Name}) imports while reorganizing modules. -
To browse the shipped stdlib, generate docs for it directly:
hew doc std/ --output-dir doc/std
This is the recommended discovery workflow today;
hew doc --listdoes not exist.
See also:
../examples/directory_module_demo/README.md,
../examples/multifile/README.md, and
specs/HEW-SPEC.md.
Common signs:
non-exhaustive match: missing Blue- the same kind of error when a
matchonOption<T>skipsNone - the same kind of error when a
matchonResult<T, E>skipsOkorErr
What to check:
- Matches over enums,
Option<T>,Result<T, E>, machine states, andboolare fail-closed: cover every case or add_ => .... - For scalar or open-ended values such as
int, a missing catch-all is only a warning. - When a new variant or state lands, update old match sites before chasing downstream type errors.
- For machine-specific transition and exhaustiveness rules, see
specs/MACHINE-SPEC.md.
Common signs:
- a
cannot assign to immutable variableerror - a
variable ... is already defined in this scopeerror - a warning that a variable shadows a binding in an outer scope
What to check:
letbindings are immutable. Change a binding tovaronly when reassignment is actually intended.- Same-scope rebinding is an error. Rename the second binding instead of treating it like reassignment.
- Nested-scope shadowing is a warning for locals, but it can be a hard error when it would shadow synthetic bindings such as actor fields.
- Prefix intentionally unused or intentionally shadowed names with
_to suppress noise.
Common signs:
- an
undefined functionerror cannot find value ... in this scope/cannot find type ... in this scopethis function takes N argument(s) but M were supplied
What to check:
- Fix spelling first. Hew can suggest close matches for values, functions, types, and fields.
- Re-check whether the call should stay qualified under a module
(
utils.helper()) or be brought into scope by a selective import. - Recount arguments after refactors, especially when constructors or helper signatures changed.
Common signs:
- an
error: removed required field ...compatibility failure wire check: 1 error(s), 0 warning(s)
What to check:
- Compare the current schema against a baseline with
hew wire check <file.hew> --against baseline.hew. - Treat field tags as stable IDs. Do not renumber or reuse them.
- Removing required fields, changing a wire declaration from struct to enum (or
back), or setting
min_versionabove the baseline version is breaking. - Use the last released or otherwise agreed baseline schema, not another in-progress branch snapshot.
hew watch re-runs type-checking (and optionally the program) every time a
watched file changes. It uses the same check pipeline as hew check, so
all diagnostics appear in the same format.
hew watch myapp.hew # Re-check on every save
hew watch --run myapp.hew # Re-check and re-run on each successful check
hew watch --clear myapp.hew # Clear terminal before each check
hew watch --debounce 500 myapp.hew # Wait 500 ms after last event (default: 300)This is the recommended inner-loop workflow for type-error hunts and
refactors. Exit with Ctrl-C.
For the full flag reference, see the Watch mode section of
../hew-cli/README.md.
Common signs:
Error: <file>: <message>on stderr and one or more modules missing from the output directoryNo .hew files foundfollowed by exit 1No modules to documentfollowed by exit 1--openhas no visible effect
What to check:
- Files that fail to parse are skipped: their errors are printed to stderr,
but documentation for any valid files in the same run is still written.
hew docexits 1 after generation if any file had parse errors. Runhew check <file.hew>on each source file first to identify and fix parse errors so all modules appear in the output. - Parse warnings are also printed to stderr, but they do not block generation or force a non-zero exit on their own.
- If no output is written and there are no parse errors, confirm that the input
path exists and contains
.hewfiles.hew docdoes not fall back to the current directory — pass at least one file or directory explicitly. - To browse the stdlib, point
hew docat the shipped stdlib tree itself (hew doc std/from a repo checkout or install tree root). --openonly opensindex.htmlafter HTML generation. It is silently ignored when--format markdownis set.- The output directory (default
./doc) is created automatically. If creation fails (e.g. a permissions issue), the error is printed to stderr andhew docexits 1.
../hew-cli/README.md— CLI command reference../examples/README.md— runnable example entry points../examples/directory_module_demo/README.md— directory-form modules../examples/multifile/README.md— multi-file module patternscross-platform-build-guide.md— native toolchain setupspecs/HEW-SPEC.md— language and module-system rulesspecs/MACHINE-SPEC.md— machine semanticsdiagrams.md— compiler pipeline and runtime diagrams
If you still need help, include the exact hew command, the entry-point file
path, the full diagnostic output, hew version, and your OS/toolchain details.