vitessio/vitess · error

package %s is not under %s

Error message

package %s is not under %s

What it means

ci-config's pkgDir maps a package import path from the CI config into a directory under the repo root by stripping the module prefix (e.g. vitess.io/vitess/). If the import path doesn't start with that prefix, it cannot be resolved to a directory and this error is returned. It guards against misconfigured package entries in the CI config.

Source

Thrown at go/tools/ci-config/check.go:112

		sort.Strings(names)
		for _, name := range names {
			if prev, ok := firstSeen[name]; ok {
				problems = append(problems, fmt.Sprintf("duplicate entry %q defined in both %s and %s", name, prev, path))
			} else {
				firstSeen[name] = path
			}
			entries = append(entries, entry{configFile: path, name: name, test: config.Tests[name]})
		}
	}
	return entries, problems
}

// pkgDir maps a package import path from a config entry to a directory
// under root.
func pkgDir(root, importPath string) (string, error) {
	rel, ok := strings.CutPrefix(importPath, modulePrefix)
	if !ok {
		return "", fmt.Errorf("package %s is not under %s", importPath, modulePrefix)
	}
	return filepath.Join(root, filepath.FromSlash(rel)), nil
}

// listTests returns the names of all top-level test functions declared in
// the *_test.go files of dir, sorted and deduplicated. It mirrors how cmd/go
// discovers tests (isTestFunc/isTest in cmd/go/internal/load/test.go):
// internal and external test packages both count, TestMain(m *testing.M) is
// the test entrypoint rather than a test, and a TestMain(t *testing.T) is a
// regular test. Build constraints are deliberately ignored: CI runs on
// linux, and a tag-guarded orphan still deserves triage.
func listTests(dir string) ([]string, error) {
	dirEntries, err := os.ReadDir(dir)
	if err != nil {
		return nil, err
	}
	fset := token.NewFileSet()
	seen := make(map[string]bool)

View on GitHub (pinned to 01a25a7d17)

Solutions

  1. Check the import path in the config entry and ensure it starts with the Vitess module prefix (vitess.io/vitess/)
  2. Fix typos (e.g. vitessio vs vitess.io) and remove any paths belonging to external modules
  3. Use a relative package path under go/ if the tool expects paths relative to root instead of full imports
  4. Verify by running the ci-config tool locally after the edit

Example fix

// before (config entry)
package: go/vt/vtgate/...
// after
package: vitess.io/vitess/go/vt/vtgate/...
Defensive patterns

Strategy: validation

Validate before calling

const modulePrefix = "vitess.io/vitess/"
func validatePkgEntry(importPath string) error {
    if !strings.HasPrefix(importPath, modulePrefix) {
        return fmt.Errorf("config entry %q must start with %q", importPath, modulePrefix)
    }
    return nil
}

Try / catch

dir, err := pkgDir(root, importPath)
if err != nil {
    return fmt.Errorf("fix ci config entry %q: %w", importPath, err)
}

Prevention

When it happens

Trigger: A config entry in .github/workflows or the ci-config input lists a package import path that does not begin with the module's prefix — e.g. `golang.org/x/tools/...`, a typo like `vitessio/vitess/go/vt/...`, or an absolute file path instead of an import path.

Common situations: Editing go/test/endtoend or workflow CI config and typing the import path by hand; adding a package from a dependency module instead of the vitess module; renaming the module path without updating config entries.

Related errors


AI-assisted analysis of vitessio/vitess@01a25a7d17 (2026-09-01). Data as JSON: /api/errors/ba1a0987dbf69746. Report an issue: GitHub.