{"record":{"id":"09c573fa50a5fde7","repo":"weaviate/weaviate","slug":"cohere-w","errorCode":null,"errorMessage":"cohere: %w","messagePattern":"cohere: %w","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"usecases/modulecomponents/clients/aws/aws.go","lineNumber":303,"sourceCode":"\t\t\t\treturn nil, nil, fmt.Errorf(\"amazon: %w\", err)\n\t\t\t}\n\t\t\ttextEmbeddings = append(textEmbeddings, embeddings)\n\t\t}\n\t\tfor i := range images {\n\t\t\tembeddings, err := c.invokeAmazonModel(ctx, \"\", images[i], awsKey, awsSecret, awsSessionToken, maxRetries, settings)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"amazon: %w\", err)\n\t\t\t}\n\t\t\timageEmbeddings = append(imageEmbeddings, embeddings)\n\t\t}\n\t\treturn textEmbeddings, imageEmbeddings, nil\n\t} else if strings.Contains(model, \"cohere.\") {\n\t\tvar textEmbeddings, imageEmbeddings [][]float32\n\t\tvar err error\n\t\tif len(texts) > 0 {\n\t\t\ttextEmbeddings, err = c.invokeCohereModel(ctx, texts, nil, awsKey, awsSecret, awsSessionToken, maxRetries, settings)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"cohere: %w\", err)\n\t\t\t}\n\t\t}\n\t\tif len(images) > 0 {\n\t\t\timageEmbeddings, err = c.invokeCohereModel(ctx, nil, images, awsKey, awsSecret, awsSessionToken, maxRetries, settings)\n\t\t\tif err != nil {\n\t\t\t\treturn nil, nil, fmt.Errorf(\"cohere: %w\", err)\n\t\t\t}\n\t\t}\n\t\treturn textEmbeddings, imageEmbeddings, nil\n\t} else {\n\t\treturn nil, nil, fmt.Errorf(\"unknown model provider: %s\", model)\n\t}\n}\n\nfunc (c *Client) invokeAmazonModel(ctx context.Context,\n\ttext, image string,\n\tawsKey, awsSecret, awsSessionToken string,\n\tmaxRetries int,","sourceCodeStart":285,"sourceCodeEnd":321,"githubUrl":"https://github.com/weaviate/weaviate/blob/75aa4b6d11f8818305aafd4440b4e32794f7ca04/usecases/modulecomponents/clients/aws/aws.go#L285-L321","documentation":"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.","triggerScenarios":"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.","commonSituations":"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).","solutions":["Check the wrapped error for HTTP status / AWS error code","Verify the Cohere embedding model ID and region (models are region-scoped on Bedrock)","Split or truncate texts to stay within Cohere's token/batch limits","Enable model access for Cohere models in the AWS console"],"exampleFix":null,"handlingStrategy":"retry","validationCode":"for _, t := range texts { if utf8.RuneCountInString(t) > cohereMaxTokensApprox { return errors.New(\"text exceeds model limit\") } }","typeGuard":null,"tryCatchPattern":"var ae smithy.APIError\nif errors.As(err, &ae) && ae.ErrorCode() == \"ThrottlingException\" { time.Sleep(backoff); retry() }","preventionTips":["Keep text batches within Cohere limits","Enable Cohere models in your Bedrock region","Use supported region/model combinations","Tune module retry settings for batch workloads"],"tags":["aws","bedrock","cohere"],"backgroundTag":"bedrock-invoke-failure","analyzedSha":"75aa4b6d11f8818305aafd4440b4e32794f7ca04","analyzedAt":"2026-09-04T14:58:20.392Z","contentChangedAt":"2026-09-04T14:58:20.392Z","schemaVersion":2},"datasetVersion":"2026-09-11T21:17:09.523Z"}