{"record":{"id":"9cf64e6892a1cf42","repo":"continuedev/continue","slug":"unsupported-embeddings-type-received-number","errorCode":null,"errorMessage":"Unsupported embeddings type received: number[][]","messagePattern":"Unsupported embeddings type received: number\\[\\]\\[\\]","errorType":"exception","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/openai-adapters/src/apis/Bedrock.ts","lineNumber":617,"sourceCode":"    const command = new InvokeModelCommand(payload);\n    const client = await this.getClient();\n    const response = await client.send(command);\n    if (!response.body) {\n      throw new Error(\"No response body\");\n    }\n    const decoder = new TextDecoder();\n    const decoded = decoder.decode(response.body);\n    return JSON.parse(decoded);\n  }\n\n  private getEmbedTexts(body: EmbeddingCreateParams): string[] {\n    const texts: string[] = [];\n    if (typeof body.input === \"string\") {\n      texts.push(body.input);\n    } else if (body.input.length > 0) {\n      const firstVal = body.input[0];\n      if (Array.isArray(firstVal)) {\n        throw new Error(\"Unsupported embeddings type received: number[][]\");\n      }\n      if (typeof firstVal === \"string\") {\n        texts.push(...(body.input as string[]));\n      } else {\n        throw new Error(\"Unsupported embeddings type received: number[]\");\n      }\n    }\n    return texts;\n  }\n\n  async embed(body: EmbeddingCreateParams): Promise<CreateEmbeddingResponse> {\n    const texts = this.getEmbedTexts(body);\n\n    let embeddings: number[][];\n    if (body.model.startsWith(\"cohere\")) {\n      const payload = {\n        texts,\n        input_type: \"search_document\",","sourceCodeStart":599,"sourceCodeEnd":635,"githubUrl":"https://github.com/continuedev/continue/blob/5522c6f44ca0ac3528b37244818fbfa39b5af470/packages/openai-adapters/src/apis/Bedrock.ts#L599-L635","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","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."],"exampleFix":"// before\nconst res = await api.embed({ model: 'bedrock/titan-embed', input: [[101, 2054, 2003]] });\n\n// after\nconst res = await api.embed({ model: 'bedrock/titan-embed', input: ['The answer is'] });","handlingStrategy":"type-guard","validationCode":"const isStringInput = (i: unknown): i is string | string[] => typeof i === 'string' || (Array.isArray(i) && i.every(x => typeof x === 'string'));\nif (!isStringInput(body.input)) throw new TypeError('Bedrock embeddings accept only string inputs');","typeGuard":"function isEmbeddingStringInput(input: string | string[] | number[] | number[][]): input is string | string[] {\n  if (typeof input === 'string') return true;\n  return Array.isArray(input) && input.every(x => typeof x === 'string');\n}","tryCatchPattern":null,"preventionTips":["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."],"tags":["bedrock","embeddings","input-validation","token-ids"],"backgroundTag":"invalid-request-parameter","analyzedSha":"5522c6f44ca0ac3528b37244818fbfa39b5af470","analyzedAt":"2026-08-27T11:28:54.683Z","schemaVersion":2},"datasetVersion":"2026-08-27T13:17:12.746Z"}