golangci/golangci-lint · error
dependency %q hasn't been loaded yet
Error message
dependency %q hasn't been loaded yet
What it means
While rebuilding types from export data, every imported package must already have its Types package materialized. If an import was not processed earlier in the load order, golangci-lint refuses to continue because it cannot link the type graph. This is an internal invariant violation of the export-data loading pass.
Source
Thrown at pkg/goanalysis/runner_loadingpackage.go:240
}
func (lp *loadingPackage) loadFromExportData() error {
pkg := lp.pkg
// Call NewPackage directly with explicit name.
// This avoids skew between golist and go/types when the files'
// package declarations are inconsistent.
// Subtle: we populate all Types fields with an empty Package
// before loading export data so that export data processing
// never has to create a types.Package for an indirect dependency,
// which would then require that such created packages be explicitly
// inserted back into the Import graph as a final step after export data loading.
pkg.Types = types.NewPackage(pkg.PkgPath, pkg.Name)
pkg.IllTyped = true
for path, pkg := range pkg.Imports {
if pkg.Types == nil {
return fmt.Errorf("dependency %q hasn't been loaded yet", path)
}
}
if pkg.ExportFile == "" {
return fmt.Errorf("no export data for %q", pkg.ID)
}
f, err := os.Open(pkg.ExportFile)
if err != nil {
return err
}
defer f.Close()
r, err := gcexportdata.NewReader(f)
if err != nil {
return err
}
View on GitHub (pinned to ed7a235d2d)
Solutions
- Run `go clean -cache` and retry the lint
- Update golangci-lint to the latest version (this loader has had ordering fixes)
- Verify go.mod replace/vendor directives don't create cycles or missing entries
- Reproduce with GOFLAGS/GODEBUG off and minimal config to isolate tooling interference
Defensive patterns
Strategy: retry
Try / catch
// treat as transient infra failure: clean cache and retry
if strings.Contains(err.Error(), "hasn't been loaded yet") {
go clean -cache; rerun golangci-lint
} Prevention
- Keep golangci-lint updated (loader ordering fixes)
- Avoid unusual replace/vendor setups that break load order
- Run lint in a clean, warmed CI environment
When it happens
Trigger: pkg.Imports contains an entry whose Types is nil when loadFromExportData iterates imports — i.e. the dependency was not loaded before this package in the export-data pass (called via loadImportedPackageWithFacts).
Common situations: Build-cache/export-file inconsistencies after a Go upgrade; parallel loading race in exotic setups; vendored or replace directives producing unexpected load order.
Related errors
- no export data for %q
- failed to load package %s: %w
- the configuration contains invalid elements
- unsupported configuration format
- the configuration contains invalid elements
AI-assisted analysis of golangci/golangci-lint@ed7a235d2d (2026-09-02).
Data as JSON: /api/errors/90bf5506349a1806.
Report an issue: GitHub.