jdx/mise · error
Go workspace module is missing
Error message
Go workspace module {} is missing {GO_MOD} What it means
During Go workspace discovery, mise resolves each `use` directory from go.work and requires it to exist. If the candidate directory does not exist and the miss is not attributable to lexical-vs-canonical path divergence (i.e. it does not resolve outside the workspace), discovery fails with 'module ... is missing go.mod'. The message is slightly misleading: the immediate trigger is that the directory itself is absent.
Solutions
- Create the missing directory with a valid go.mod (`go mod init <module>`), or
- Remove/fix the stale `use` entry in go.work (`go work use -r .` or edit it manually), or
- Run `go work sync` / `go work use` to let Go regenerate a consistent go.work.
- If the directory exists, check for symlinks or case-sensitivity mismatches that make the path resolve differently.
Example fix
// before (go.work) go 1.22 use ./services/old-api // after (directory was renamed) go 1.22 use ./services/api
Defensive patterns
Strategy: validation
Validate before calling
// shell, before relying on discovery
while read -r dir; do
[ -d "$dir" ] || echo "go.work references missing dir: $dir"
done < <(go list -m -f '{{.Dir}}' all 2>/dev/null || awk '/^use/{print $2}' go.work) Try / catch
match discovery_result {
Err(e) if e.to_string().contains("is missing go.mod") => {
eprintln!("stale go.work entry; regenerating");
// run `go work use -r .` and retry
}
r => r?,
} Prevention
- Regenerate go.work with `go work use -r .` after adding/removing/renaming modules
- Never hand-delete a module directory without updating go.work
- Commit go.work together with the directory changes it references
When it happens
Trigger: A `go.work` file contains `use ./somedir` (or an absolute use path inside the workspace root) but `somedir/` does not exist on disk when mise runs workspace discovery.
Common situations: Deleted or renamed module directory without updating go.work; checkout that skips empty dirs; uncommitted new module referenced by go.work; typo in the use path.
Understand the failure class
Background: "File not found" and ENOENT errors: why libraries can't find a file that should exist — this error's family across 50 libraries.
Related errors
- Go workspace module is missing go.mod
- unterminated use block
- affected project exists in graph
- brew-cask: binary artifact
- brew-cask: command wrapper
AI-assisted analysis of jdx/mise@533346cc37 (2026-09-17).
Data as JSON: /api/errors/5116ce5180488edc.
Report an issue: GitHub.
Appendix: source
Thrown at src/task/workspace/go.rs:63
for directory in module_directories {
let candidate = if directory.is_absolute() {
directory
} else {
workspace_root.join(directory)
};
let lexical_candidate = lexical_absolute(&candidate)?;
if !lexical_candidate.starts_with(&lexical_root)
&& !lexical_candidate.starts_with(&canonical_root)
{
continue;
}
let candidate = lexical_candidate;
if !context.exists(&candidate) {
if missing_path_resolves_outside(&candidate, &lexical_root, &canonical_root)? {
continue;
}
bail!(
"Go workspace module {} is missing {GO_MOD}",
candidate.display()
);
}
let canonical_module = context.canonicalize(&candidate).wrap_err_with(|| {
format!(
"failed to resolve Go workspace module {}",
candidate.display()
)
})?;
let Ok(relative) = canonical_module.strip_prefix(&canonical_root) else {
continue;
};
if !context.is_file(&canonical_module.join(GO_MOD)) {
bail!(
"Go workspace module {} is missing {GO_MOD}",
candidate.display()
);View on GitHub (pinned to 533346cc37)