{"record":{"id":"7d78a610f3286e47","repo":"slimtoolkit/slim","slug":"unexpected-http-status-code","errorCode":null,"errorMessage":"unexpected HTTP status code","messagePattern":"unexpected HTTP status code","errorType":"http","errorClass":null,"httpStatus":null,"severity":"error","filePath":"pkg/app/master/update/update.go","lineNumber":36,"sourceCode":"\n\t\"github.com/c4milo/unpackit\"\n\tlog \"github.com/sirupsen/logrus\"\n\t\"github.com/slimtoolkit/go-update\"\n\t\"github.com/slimtoolkit/uiprogress\"\n)\n\nconst (\n\thdrUserAgent     = \"User-Agent\"\n\thdrContentLength = \"Content-Length\"\n\tdownloadEndpoint = \"https://downloads.dockerslim.com/releases\"\n\tmasterAppName    = \"slim\"\n\tsensorAppName    = \"slim-sensor\"\n\tdistDirName      = \"dist\"\n\tartifactsPerms   = 0740\n)\n\nvar (\n\terrUnexpectedHTTPStatus = errors.New(\"unexpected HTTP status code\")\n)\n\n// Run checks the current version and updates it if it doesn't match the latest available version\nfunc Run(doDebug bool, statePath string, inContainer, isDSImage, doShowProgress bool) {\n\tlogger := log.WithFields(log.Fields{\"app\": \"slim\", \"command\": \"update\"})\n\n\tappPath, err := os.Executable()\n\terrutil.FailOn(err)\n\tappDirPath := filepath.Dir(appPath)\n\n\tvstatus := vchecker.Check(inContainer, isDSImage)\n\tlogger.Debugf(\"Version Status => %+v\", vstatus)\n\n\tif vstatus == nil || vstatus.Status != \"success\" {\n\t\tfmt.Printf(\"slim[update]: info=status message='version check was not successful'\\n\")\n\t\tfmt.Printf(\"slim[update]: state=exited version=%s\\n\", vinfo.Current())\n\t\treturn\n\t}","sourceCodeStart":18,"sourceCodeEnd":54,"githubUrl":"https://github.com/slimtoolkit/slim/blob/81940d17fa112cc678e32209214bcb2355cb3004/pkg/app/master/update/update.go#L18-L54","documentation":"The auto-updater's downloadRelease fetches release artifacts over HTTP and treats any non-success status as errUnexpectedHTTPStatus (declared in update.go). It signals that the remote server did not return the expected downloadable response.","triggerScenarios":"downloadRelease requesting a release artifact URL that returns e.g. 404 (release removed/renamed), 403, or 5xx instead of the artifact.","commonSituations":"Update feed URL outdated or moved; GitHub rate limiting / network proxy blocking the download; artifact version no longer published.","solutions":["Check the release/download URL manually and confirm it returns 200","Verify network/proxy allows reaching the release host (no 403/451)","Retry later if the server returned 5xx, or pin a locally available version"],"exampleFix":"// before\nresp, _ := http.Get(\"https://example.com/dist/old.tar.gz\") // 404\n// after\nresp, _ := http.Get(\"https://example.com/dist/latest.tar.gz\") // valid artifact","handlingStrategy":"retry","validationCode":"resp, err := http.Head(releaseURL)\nif err != nil || resp.StatusCode != http.StatusOK {\n  return fmt.Errorf(\"release URL %s unavailable (status %v)\", releaseURL, resp)\n}","typeGuard":null,"tryCatchPattern":"if err := update.Run(...); err != nil && errors.Is(err, errUnexpectedHTTPStatus) {\n  // log, back off, retry later or skip auto-update\n}","preventionTips":["Check release URLs return 200 before scheduling updates","Allowlist the release host in proxies/firewalls","Handle 404s when releases are rotated or removed"],"tags":["http","update","download"],"backgroundTag":"unexpected-http-status","analyzedSha":"81940d17fa112cc678e32209214bcb2355cb3004","analyzedAt":"2026-08-31T23:06:12.682Z","contentChangedAt":null,"schemaVersion":2},"datasetVersion":"2026-09-08T05:18:18.240Z"}