{"record":{"id":"94d039a2857949b4","repo":"AlistGo/alist","slug":"negative-content-size-not-supported","errorCode":null,"errorMessage":"negative content size not supported","messagePattern":"negative content size not supported","errorType":"http","errorClass":null,"httpStatus":500,"severity":"error","filePath":"internal/net/serve.go","lineNumber":66,"sourceCode":"// modtime to decide whether the content needs to be sent at all.\n//\n// The content's RangeReadCloser method must work: ServeHTTP gives a range,\n// caller will give the reader for that Range.\n//\n// If the caller has set w's ETag header formatted per RFC 7232, section 2.3,\n// ServeHTTP uses it to handle requests using If-Match, If-None-Match, or If-Range.\nfunc ServeHTTP(w http.ResponseWriter, r *http.Request, name string, modTime time.Time, size int64, RangeReadCloser model.RangeReadCloserIF) error {\n\tdefer RangeReadCloser.Close()\n\tsetLastModified(w, modTime)\n\tdone, rangeReq := checkPreconditions(w, r, modTime)\n\tif done {\n\t\treturn nil\n\t}\n\n\tif size < 0 {\n\t\t// since too many functions need file size to work,\n\t\t// will not implement the support of unknown file size here\n\t\thttp.Error(w, \"negative content size not supported\", http.StatusInternalServerError)\n\t\treturn nil\n\t}\n\n\tcode := http.StatusOK\n\n\t// If Content-Type isn't set, use the file's extension to find it, but\n\t// if the Content-Type is unset explicitly, do not sniff the type.\n\tcontentTypes, haveType := w.Header()[\"Content-Type\"]\n\tvar contentType string\n\tif !haveType {\n\t\tcontentType = mime.TypeByExtension(filepath.Ext(name))\n\t\tif contentType == \"\" {\n\t\t\t// most modern application can handle the default contentType\n\t\t\tcontentType = \"application/octet-stream\"\n\t\t}\n\t\tw.Header().Set(\"Content-Type\", contentType)\n\t} else if len(contentTypes) > 0 {\n\t\tcontentType = contentTypes[0]","sourceCodeStart":48,"sourceCodeEnd":84,"githubUrl":"https://github.com/AlistGo/alist/blob/843d9dc8149126976b2625911e45a4d3ffd6f2f5/internal/net/serve.go#L48-L84","documentation":"Error \"negative content size not supported\" thrown in AlistGo/alist.","triggerScenarios":"Thrown at internal/net/serve.go:66 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["This operation is not supported by the driver/backend; use a supported alternative or a different storage driver."],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"843d9dc8149126976b2625911e45a4d3ffd6f2f5","analyzedAt":"2026-08-15T12:14:11.722Z","schemaVersion":2},"datasetVersion":"2026-08-15T17:31:12.345Z"}