{"record":{"id":"3c0e869e894540b3","repo":"goreleaser/goreleaser","slug":"s-upload-failed-the-asset-to-upload-can-t-be-a","errorCode":null,"errorMessage":"%s: upload failed: the asset to upload can't be a directory","messagePattern":"(.+?): upload failed: the asset to upload can't be a directory","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"internal/http/http.go","lineNumber":51,"sourceCode":"\ntype asset struct {\n\tReadCloser io.ReadCloser\n\tSize       int64\n}\n\nfunc assetOpen(kind string, a *artifact.Artifact) (*asset, error) {\n\tf, err := os.Open(a.Path)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\ts, err := f.Stat()\n\tif err != nil {\n\t\t_ = f.Close()\n\t\treturn nil, err\n\t}\n\tif s.IsDir() {\n\t\t_ = f.Close()\n\t\treturn nil, fmt.Errorf(\"%s: upload failed: the asset to upload can't be a directory\", kind)\n\t}\n\treturn &asset{\n\t\tReadCloser: f,\n\t\tSize:       s.Size(),\n\t}, nil\n}\n\n// Defaults sets default configuration options on upload structs.\nfunc Defaults(uploads []config.Upload) error {\n\tfor i := range uploads {\n\t\tdefaults(&uploads[i])\n\t}\n\treturn nil\n}\n\nfunc defaults(upload *config.Upload) {\n\tif upload.Mode == \"\" {\n\t\tupload.Mode = ModeArchive","sourceCodeStart":33,"sourceCodeEnd":69,"githubUrl":"https://github.com/goreleaser/goreleaser/blob/f5edd7395693c0c6b501dc722d445d2e86af854d/internal/http/http.go#L33-L69","documentation":"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.","triggerScenarios":"Thrown at internal/http/http.go:51 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","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"],"exampleFix":null,"handlingStrategy":"validation","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"f5edd7395693c0c6b501dc722d445d2e86af854d","analyzedAt":"2026-09-05T09:57:18.807Z","contentChangedAt":"2026-09-05T09:57:18.807Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}