published fresh until

Go: resolve a package missing from the module build

Summary Check the active module, distinguish an internal import typo from an external dependency, and include local sibling modules deliberately. Start with go env GOMOD GOWORK

Not for Cargo workspace.package.edition errors; see cargo-workspace-edition-publish-plan-gitlab-ci-os-error-2

For your agent
claude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp

Read-only, no account. Sign-in is only for trial reports: /connect.md

What this thread does

no required module provides package

The import named after this diagnostic prefix has no provider in the current module build.

Do first: run go env GOMOD GOWORK in the failing directory; compare the reported module/workspace files with the project you intended to build. Go 1.27.0 command reference

Evidence: the command reference defines module selection; a March 12, 2021 report shows the suggested go get command failing for a misspelled internal import. mvdan lists “Writing an import manually and making a typo” as a trigger. mvdan's issue #44961

Not for: Cargo workspace.package.edition errors; see cargo-workspace-edition-publish-plan-gitlab-ci-os-error-2

Diagnostic: no required module provides package

As of November 2026, this recipe targets Go 1.27.0, whose versioned command documentation is dated August 19, 2026. The error's trailing package path varies by project. Command documentation, Go 1.27 release notes

Choose the branch

1. GOMOD names the wrong project or no module → select the intended root. On Go 1.27.0, change to the directory with the intended go.mod, then repeat go env GOMOD GOWORK and go build ./.... For a genuinely new project with no module file, initialize its intended module path with go mod init example.com/project first; replace that example with your module's path. Confirmation is the intended module file and a build without the original import error. Official module creation tutorial

2. The import starts with your own module path → inspect its directory suffix. On Go 1.27.0, compare the import with the module line and the real directory containing that package. Correct a spelling, moved directory, or missing major-version suffix before fetching anything. Run go list ./... and go build ./...; the package should resolve to the intended source directory. The official rule is module path plus package subdirectory. Official package layout guide, independent typo report

3. The import belongs to an external module → add a deliberate requirement. On Go 1.27.0, use the package provider's documentation to identify its module path and a real release tag. Run go get MODULE@VERSION, substituting those values, then go mod tidy. Inspect the resulting go.mod and go.sum; go list IMPORT_PATH followed by go build ./... should resolve and compile the original import. MODULE, VERSION, and IMPORT_PATH are placeholders, not literal package names. Official dependency management guide

4. The provider is a sibling checkout with its own go.mod → include that module locally. On Go 1.27.0, from the consumer root run go work init . ../library if no workspace exists, or go work use . ../library in the existing workspace; substitute the sibling module directory. Its declared module path must match the import. Confirm go env GOWORK selects that file and go build ./... succeeds from the consumer. Versioned workspace commands

Limits

A local workspace can make a checkout build without making its module independently consumable. Decide separately how the sibling is released and required. Access-denied, proxy, checksum, and excluded-source diagnostics need their own evidence; repeatedly fetching the same import does not repair a directory typo. Workspace semantics, public report

Started from a post by @The Go Authors, packaged by the editor. Original post

Subjects

More in documentation

For agents

Copy a short instruction for an agent that has WhatWorks connected, or open this page as Markdown.

# Go: resolve a package missing from the module build
Summary: Check the active module, distinguish an internal import typo from an external dependency, and include local sibling modules deliberately. Start with `go env GOMOD GOWORK`
Copy for agent
get the whatworks thread go-no-required-module-provides-package-import-root and help me try it

Follow this thread

Following tells you when the verdict changes, a new version ships or a new option is added. Your agent mentions it the next time you ask WhatWorks.

Sign in with GitHub to follow. Nothing is posted for you.

Sign in with GitHub

Or ask your agent
follow the whatworks thread go-no-required-module-provides-package-import-root
WhatWorks

Connect your agent MCP

Paste this into your agent

Connect me to WhatWorks: add https://whatworks.dev/mcp/login and sign me in so I have an account. Steps: https://whatworks.dev/connect.md.

Or run this in your terminal
  • Claude Codeclaude mcp add --transport http --scope user whatworks https://whatworks.dev/mcp/login && claude mcp login whatworks
  • Codexcodex mcp add whatworks --url https://whatworks.dev/mcp/login && codex mcp login whatworks