weaviate/weaviate · error

cohere: %w

Error message

cohere: %w

What it means

Wraps an error from invoking the Cohere embedding model on Bedrock for the batch of texts. The 'cohere:' prefix marks the provider branch in sendBedrockRequest. The entire text-embedding request fails if the single batched Cohere invoke fails.

Source

Thrown at usecases/modulecomponents/clients/aws/aws.go:303

				return nil, nil, fmt.Errorf("amazon: %w", err)
			}
			textEmbeddings = append(textEmbeddings, embeddings)
		}
		for i := range images {
			embeddings, err := c.invokeAmazonModel(ctx, "", images[i], awsKey, awsSecret, awsSessionToken, maxRetries, settings)
			if err != nil {
				return nil, nil, fmt.Errorf("amazon: %w", err)
			}
			imageEmbeddings = append(imageEmbeddings, embeddings)
		}
		return textEmbeddings, imageEmbeddings, nil
	} else if strings.Contains(model, "cohere.") {
		var textEmbeddings, imageEmbeddings [][]float32
		var err error
		if len(texts) > 0 {
			textEmbeddings, err = c.invokeCohereModel(ctx, texts, nil, awsKey, awsSecret, awsSessionToken, maxRetries, settings)
			if err != nil {
				return nil, nil, fmt.Errorf("cohere: %w", err)
			}
		}
		if len(images) > 0 {
			imageEmbeddings, err = c.invokeCohereModel(ctx, nil, images, awsKey, awsSecret, awsSessionToken, maxRetries, settings)
			if err != nil {
				return nil, nil, fmt.Errorf("cohere: %w", err)
			}
		}
		return textEmbeddings, imageEmbeddings, nil
	} else {
		return nil, nil, fmt.Errorf("unknown model provider: %s", model)
	}
}

func (c *Client) invokeAmazonModel(ctx context.Context,
	text, image string,
	awsKey, awsSecret, awsSessionToken string,
	maxRetries int,

View on GitHub (pinned to 75aa4b6d11)

Solutions

  1. Check the wrapped error for HTTP status / AWS error code
  2. Verify the Cohere embedding model ID and region (models are region-scoped on Bedrock)
  3. Split or truncate texts to stay within Cohere's token/batch limits
  4. Enable model access for Cohere models in the AWS console
Defensive patterns

Strategy: retry

Validate before calling

for _, t := range texts { if utf8.RuneCountInString(t) > cohereMaxTokensApprox { return errors.New("text exceeds model limit") } }

Try / catch

var ae smithy.APIError
if errors.As(err, &ae) && ae.ErrorCode() == "ThrottlingException" { time.Sleep(backoff); retry() }

Prevention

When it happens

Trigger: vectorize with a 'cohere.' model and non-empty texts where invokeCohereModel returns an error — HTTP error from Bedrock, invalid model ID, or oversized text batch.

Common situations: cohere.embed-english-v3 (or multilingual) not enabled in the region; text input exceeding Cohere token limits; region mismatch (Cohere models unavailable in some regions).

Related errors


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