slimtoolkit/slim · error

unexpected HTTP status code

Error message

unexpected HTTP status code

What it means

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.

Source

Thrown at pkg/app/master/update/update.go:36

	"github.com/c4milo/unpackit"
	log "github.com/sirupsen/logrus"
	"github.com/slimtoolkit/go-update"
	"github.com/slimtoolkit/uiprogress"
)

const (
	hdrUserAgent     = "User-Agent"
	hdrContentLength = "Content-Length"
	downloadEndpoint = "https://downloads.dockerslim.com/releases"
	masterAppName    = "slim"
	sensorAppName    = "slim-sensor"
	distDirName      = "dist"
	artifactsPerms   = 0740
)

var (
	errUnexpectedHTTPStatus = errors.New("unexpected HTTP status code")
)

// Run checks the current version and updates it if it doesn't match the latest available version
func Run(doDebug bool, statePath string, inContainer, isDSImage, doShowProgress bool) {
	logger := log.WithFields(log.Fields{"app": "slim", "command": "update"})

	appPath, err := os.Executable()
	errutil.FailOn(err)
	appDirPath := filepath.Dir(appPath)

	vstatus := vchecker.Check(inContainer, isDSImage)
	logger.Debugf("Version Status => %+v", vstatus)

	if vstatus == nil || vstatus.Status != "success" {
		fmt.Printf("slim[update]: info=status message='version check was not successful'\n")
		fmt.Printf("slim[update]: state=exited version=%s\n", vinfo.Current())
		return
	}

View on GitHub (pinned to 81940d17fa)

Solutions

  1. Check the release/download URL manually and confirm it returns 200
  2. Verify network/proxy allows reaching the release host (no 403/451)
  3. Retry later if the server returned 5xx, or pin a locally available version

Example fix

// before
resp, _ := http.Get("https://example.com/dist/old.tar.gz") // 404
// after
resp, _ := http.Get("https://example.com/dist/latest.tar.gz") // valid artifact
Defensive patterns

Strategy: retry

Validate before calling

resp, err := http.Head(releaseURL)
if err != nil || resp.StatusCode != http.StatusOK {
  return fmt.Errorf("release URL %s unavailable (status %v)", releaseURL, resp)
}

Try / catch

if err := update.Run(...); err != nil && errors.Is(err, errUnexpectedHTTPStatus) {
  // log, back off, retry later or skip auto-update
}

Prevention

When it happens

Trigger: downloadRelease requesting a release artifact URL that returns e.g. 404 (release removed/renamed), 403, or 5xx instead of the artifact.

Common situations: Update feed URL outdated or moved; GitHub rate limiting / network proxy blocking the download; artifact version no longer published.

Related errors


AI-assisted analysis of slimtoolkit/slim@81940d17fa (2026-08-31). Data as JSON: /api/errors/7d78a610f3286e47. Report an issue: GitHub.