goreleaser/goreleaser · error
%s: upload failed: the asset to upload can't be a directory
Error message
%s: upload failed: the asset to upload can't be a directory
What it means
Validation error in http.assetOpen: the artifact path opened for upload stat'd as a directory. HTTP uploads stream a single file body, so a directory cannot be uploaded; the upload kind prefix identifies which upload config selected this artifact.
Source
Thrown at internal/http/http.go:51
type asset struct {
ReadCloser io.ReadCloser
Size int64
}
func assetOpen(kind string, a *artifact.Artifact) (*asset, error) {
f, err := os.Open(a.Path)
if err != nil {
return nil, err
}
s, err := f.Stat()
if err != nil {
_ = f.Close()
return nil, err
}
if s.IsDir() {
_ = f.Close()
return nil, fmt.Errorf("%s: upload failed: the asset to upload can't be a directory", kind)
}
return &asset{
ReadCloser: f,
Size: s.Size(),
}, nil
}
// Defaults sets default configuration options on upload structs.
func Defaults(uploads []config.Upload) error {
for i := range uploads {
defaults(&uploads[i])
}
return nil
}
func defaults(upload *config.Upload) {
if upload.Mode == "" {
upload.Mode = ModeArchiveView on GitHub (pinned to f5edd73956)
Solutions
- Point the upload at a file artifact, not a directory
- Configure the correct artifact filter/mode (binary or archive) so directories are not selected
- Pre-filter artifacts before upload so directory paths never reach assetOpen
Defensive patterns
Strategy: validation
When it happens
Trigger: Thrown at internal/http/http.go:51 when the library encounters an invalid state.
Common situations: See trigger scenarios.
AI-assisted analysis of goreleaser/goreleaser@f5edd73956 (2026-09-05).
Data as JSON: /api/errors/3c0e869e894540b3.
Report an issue: GitHub.