continuedev/continue · error · Error
Unsupported embeddings type received: number[][]
Error message
Unsupported embeddings type received: number[][]
What it means
getEmbedTexts validates the OpenAI-style embedding `input` parameter: Bedrock embedding models only accept strings (or an array of strings), not pre-tokenized token-ID arrays. If the first element of input is itself an array (i.e. input is number[][]), the adapter throws this error before any AWS call is made.
Source
Thrown at packages/openai-adapters/src/apis/Bedrock.ts:617
const command = new InvokeModelCommand(payload);
const client = await this.getClient();
const response = await client.send(command);
if (!response.body) {
throw new Error("No response body");
}
const decoder = new TextDecoder();
const decoded = decoder.decode(response.body);
return JSON.parse(decoded);
}
private getEmbedTexts(body: EmbeddingCreateParams): string[] {
const texts: string[] = [];
if (typeof body.input === "string") {
texts.push(body.input);
} else if (body.input.length > 0) {
const firstVal = body.input[0];
if (Array.isArray(firstVal)) {
throw new Error("Unsupported embeddings type received: number[][]");
}
if (typeof firstVal === "string") {
texts.push(...(body.input as string[]));
} else {
throw new Error("Unsupported embeddings type received: number[]");
}
}
return texts;
}
async embed(body: EmbeddingCreateParams): Promise<CreateEmbeddingResponse> {
const texts = this.getEmbedTexts(body);
let embeddings: number[][];
if (body.model.startsWith("cohere")) {
const payload = {
texts,
input_type: "search_document",View on GitHub (pinned to 5522c6f44c)
Solutions
- Pass plain strings: embed({model, input: ['hello world', ...]}).
- If your pipeline holds token IDs, decode them back to text with the same tokenizer before calling embed.
- Add a runtime type check on input before dispatching to Bedrock.
Example fix
// before
const res = await api.embed({ model: 'bedrock/titan-embed', input: [[101, 2054, 2003]] });
// after
const res = await api.embed({ model: 'bedrock/titan-embed', input: ['The answer is'] }); Defensive patterns
Strategy: type-guard
Validate before calling
const isStringInput = (i: unknown): i is string | string[] => typeof i === 'string' || (Array.isArray(i) && i.every(x => typeof x === 'string'));
if (!isStringInput(body.input)) throw new TypeError('Bedrock embeddings accept only string inputs'); Type guard
function isEmbeddingStringInput(input: string | string[] | number[] | number[][]): input is string | string[] {
if (typeof input === 'string') return true;
return Array.isArray(input) && input.every(x => typeof x === 'string');
} Prevention
- Always pass text strings, never token IDs, to Bedrock embeddings.
- Decode token arrays back to text before embedding.
- Validate input shape at the boundary of your pipeline.
When it happens
Trigger: Calling embed with input: [[1,2,3],[4,5,6]] or any array-of-arrays of token IDs; code written against OpenAI's token-embedding mode reused with the Bedrock adapter; sending token arrays produced by a tokenizer (e.g. tiktoken) directly.
Common situations: Porting OpenAI embeddings code (which accepts token arrays) to Bedrock; caching layers that pre-tokenize and store number[][]; batch pipelines that forget to decode tokens back to text.
Related errors
- Unsupported embeddings type received: number[]
- Unsupported model: ${body.model}
- Query and chunks must not be empty
- Failed to fetch messages: ${response.statusText}
- No workspace directories found
AI-assisted analysis of continuedev/continue@5522c6f44c (2026-08-27).
Data as JSON: /api/errors/9cf64e6892a1cf42.
Report an issue: GitHub.