golang/go · error · DownloadDirPartialError
not completely extracted
Error message
not completely extracted
What it means
A `.partial` marker file is created at the start of a module download and removed once the zip is fully extracted. Its presence next to the module directory means extraction was interrupted, so DownloadDir returns a DownloadDirPartialError rather than a half-extracted directory.
Source
Thrown at src/cmd/go/internal/modfetch/cache.go:113
// Check whether the directory itself exists.
dir := filepath.Join(cfg.GOMODCACHE, enc+"@"+encVer)
if fi, err := os.Stat(dir); os.IsNotExist(err) {
return dir, err
} else if err != nil {
return dir, &DownloadDirPartialError{dir, err}
} else if !fi.IsDir() {
return dir, &DownloadDirPartialError{dir, errors.New("not a directory")}
}
// Check if a .partial file exists. This is created at the beginning of
// a download and removed after the zip is extracted.
partialPath, err := CachePath(ctx, m, "partial")
if err != nil {
return dir, err
}
if _, err := os.Stat(partialPath); err == nil {
return dir, &DownloadDirPartialError{dir, errors.New("not completely extracted")}
} else if !os.IsNotExist(err) {
return dir, err
}
// Special case: ziphash is not required for the golang.org/fips140 module,
// because it is unpacked from a file in GOROOT, not downloaded.
// We've already checked that it's not a partial unpacking, so we're happy.
if m.Path == "golang.org/fips140" {
return dir, nil
}
// Check if a .ziphash file exists. It should be created before the
// zip is extracted, but if it was deleted (by another program?), we need
// to re-calculate it. Note that checkMod will repopulate the ziphash
// file if it doesn't exist, but if the module is excluded by checks
// through GONOSUMDB or GOPRIVATE, that check and repopulation won't happen.
ziphashPath, err := CachePath(ctx, m, "ziphash")
if err != nil {View on GitHub (pinned to b6b368adc5)
Solutions
- Run `go mod download <module>` again; the go command will detect the partial state and retry extraction.
- If retries fail, run `go clean -modcache` and re-download from scratch.
- Free disk space if the original extraction failed due to ENOSPC, then retry.
Defensive patterns
Strategy: retry
Validate before calling
// Detect the partial marker:
// if _, err := os.Stat(filepath.Join(dir, ".partial")); err == nil {
// // incomplete extraction; remove and re-download
// } Try / catch
// On *modfetch.DownloadDirPartialError due to .partial, delete the // module dir and its .partial file, then `go mod download` again.
Prevention
- Let `go mod download` finish; avoid killing it mid-extraction.
- Ensure adequate disk space before large downloads.
When it happens
Trigger: DownloadDir finds a `.partial` file in the cache alongside the module's extracted directory, indicating the download/extract did not finish.
Common situations: go mod download killed (Ctrl-C, OOM) mid-extraction; disk full during extraction; a concurrent go process died holding the partial marker; system crash or power loss during download.
Related errors
AI-assisted analysis of golang/go@b6b368adc5 (2026-08-12).
Data as JSON: /api/errors/3c29af32d70c30a7.
Report an issue: GitHub.