weaviate/weaviate · error

init context expired before remote was ready

Error message

init context expired before remote was ready

What it means

WaitForStartup polls the inference service's /.well-known/ready endpoint every `interval` until the init context expires. If every checkReady attempt failed until initCtx is done, it wraps the last observed error as 'init context expired before remote was ready'. This is Weaviate's startup gating failing because the remote inference service never became healthy in time.

Source

Thrown at modules/multi2vec-bind/clients/startup.go:40

func (v *vectorizer) WaitForStartup(initCtx context.Context,
	interval time.Duration,
) error {
	t := time.NewTicker(interval)
	defer t.Stop()
	expired := initCtx.Done()
	var lastErr error
	for {
		select {
		case <-t.C:
			lastErr = v.checkReady(initCtx)
			if lastErr == nil {
				return nil
			}
			v.logger.
				WithField("action", "multi2vec_remote_wait_for_startup").
				WithError(lastErr).Warnf("multi2vec-bind inference service not ready")
		case <-expired:
			return errors.Wrapf(lastErr, "init context expired before remote was ready")
		}
	}
}

func (v *vectorizer) checkReady(initCtx context.Context) error {
	// spawn a new context (derived on the overall context) which is used to
	// consider an individual request timed out
	requestCtx, cancel := context.WithTimeout(initCtx, 500*time.Millisecond)
	defer cancel()

	req, err := http.NewRequestWithContext(requestCtx, http.MethodGet,
		v.url("/.well-known/ready"), nil)
	if err != nil {
		return errors.Wrap(err, "create check ready request")
	}

	res, err := v.httpClient.Do(req)
	if err != nil {

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Start/repair the multi2vec-bind inference container and confirm /.well-known/ready returns 200 with curl
  2. Give the container more time — large models may take minutes to load; increase the init context deadline
  3. Check the lastErr (wrapped inside) in the log to see the underlying cause: connection refused vs HTTP status vs timeout
  4. Fix INFERENCE_ORIGIN if it points to the wrong host/port
  5. Check inference container logs for startup errors (OOM, missing model, image incompatibility)

Example fix

// before
initCtx, cancel := context.WithTimeout(context.Background(), 60*time.Second) // too short for model download
err := client.WaitForStartup(initCtx, 500*time.Millisecond)
// after
initCtx, cancel := context.WithTimeout(context.Background(), 10*time.Minute) // allow model loading
err := client.WaitForStartup(initCtx, 500*time.Millisecond)
Defensive patterns

Strategy: retry

Validate before calling

ctx, cancel := context.WithTimeout(context.Background(), 10*time.Minute) // generous for model loading
defer cancel()
for {
	resp, err := http.Get(origin + "/.well-known/ready")
	if err == nil && resp.StatusCode == http.StatusOK {
		resp.Body.Close()
		break
	}
	if resp != nil { resp.Body.Close() }
	time.Sleep(5 * time.Second)
}

Try / catch

if err := client.WaitForStartup(initCtx, time.Second); err != nil {
	if strings.Contains(err.Error(), "init context expired before remote was ready") {
		// unwrap lastErr: distinguish connection refused vs status; log inference container state
		log.Errorf("multi2vec-bind never became ready: %v", err)
	}
	return err
}

Prevention

When it happens

Trigger: Calling WaitForStartup(initCtx, interval) when the multi2vec-bind container is absent, still downloading model weights, crashed, or reachable only after initCtx's deadline; lastErr may be a connection refused, timeout, or 'not ready: status N' error.

Common situations: First boot with large multi-modal models still downloading inside the container, exceeding the init timeout; inference container crashed on startup; wrong INFERENCE_ORIGIN so readiness is never reachable; too-short init context in tests.

Related errors


AI-assisted analysis of weaviate/weaviate@75aa4b6d11 (2026-09-04). Data as JSON: /api/errors/29e950f007d6003e. Report an issue: GitHub.