Skip to content

fix(ai): default missing embedding warnings#15324

Merged
aayush-kapoor merged 1 commit into
vercel:mainfrom
Kage18:kage-fix-embedding-v2-missing-warnings
May 15, 2026
Merged

fix(ai): default missing embedding warnings#15324
aayush-kapoor merged 1 commit into
vercel:mainfrom
Kage18:kage-fix-embedding-v2-missing-warnings

Conversation

@Kage18

@Kage18 Kage18 commented May 15, 2026

Copy link
Copy Markdown
Contributor

Summary

Fixes #14926.

EmbeddingModelV2 providers can return doEmbed results without a warnings field. embed() and embedMany() currently forward that missing value into result/logging paths that expect an array, which can crash at runtime.

This defaults missing embedding warnings to [] at the embed boundary for:

  • embed()
  • embedMany() single-call path
  • embedMany() chunked path

Tests

  • pnpm --dir packages/ai exec vitest --config vitest.node.config.js --run src/embed/embed.test.ts src/embed/embed-many.test.ts
  • pnpm --dir packages/ai exec vitest --config vitest.edge.config.js --run src/embed/embed.test.ts src/embed/embed-many.test.ts
  • pnpm --filter ai type-check

@Kage18

This comment was marked as spam.

@aayush-kapoor aayush-kapoor added the backport Admins only: add this label to a pull request in order to backport it to the prior version label May 15, 2026
@aayush-kapoor
aayush-kapoor merged commit e3a0419 into vercel:main May 15, 2026
23 of 24 checks passed
github-actions Bot added a commit that referenced this pull request May 15, 2026
@github-actions github-actions Bot removed the backport Admins only: add this label to a pull request in order to backport it to the prior version label May 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

⚠️ Backport to release-v6.0 created but has conflicts: #15354

@github-actions

Copy link
Copy Markdown
Contributor

🚀 Published in:

Package Version
ai 7.0.0-canary.141
@ai-sdk/angular 3.0.0-canary.141
@ai-sdk/google 4.0.0-canary.65
@ai-sdk/google-vertex 5.0.0-canary.84
@ai-sdk/langchain 3.0.0-canary.141
@ai-sdk/llamaindex 3.0.0-canary.141
@ai-sdk/otel 1.0.0-canary.87
@ai-sdk/react 4.0.0-canary.142
@ai-sdk/rsc 3.0.0-canary.142
@ai-sdk/svelte 5.0.0-canary.141
@ai-sdk/vue 4.0.0-canary.141
@ai-sdk/workflow 1.0.0-canary.58

aayush-kapoor added a commit that referenced this pull request May 15, 2026
This is an automated backport of #15324 to the release-v6.0 branch. FYI
@Kage18
This backport has conflicts that need to be resolved manually.

### `git cherry-pick` output

```
Auto-merging packages/ai/src/embed/embed-many.test.ts
CONFLICT (content): Merge conflict in packages/ai/src/embed/embed-many.test.ts
Auto-merging packages/ai/src/embed/embed-many.ts
CONFLICT (content): Merge conflict in packages/ai/src/embed/embed-many.ts
Auto-merging packages/ai/src/embed/embed.test.ts
CONFLICT (content): Merge conflict in packages/ai/src/embed/embed.test.ts
Auto-merging packages/ai/src/embed/embed.ts
CONFLICT (content): Merge conflict in packages/ai/src/embed/embed.ts
error: could not apply e3a0419... fix(ai): default missing embedding warnings (#15324)
hint: After resolving the conflicts, mark them with
hint: "git add/rm <pathspec>", then run
hint: "git cherry-pick --continue".
hint: You can instead skip this commit with "git cherry-pick --skip".
hint: To abort and get back to the state before "git cherry-pick",
hint: run "git cherry-pick --abort".
hint: Disable this message with "git config set advice.mergeConflict false"
```

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: Aayush Kapoor <aayushkapoor34@gmail.com>
Co-authored-by: Aayush Kapoor <83492835+aayush-kapoor@users.noreply.github.com>
gr2m pushed a commit that referenced this pull request Jun 5, 2026
## Summary

Fixes #14926.

EmbeddingModelV2 providers can return doEmbed results without a warnings
field. embed() and embedMany() currently forward that missing value into
result/logging paths that expect an array, which can crash at runtime.

This defaults missing embedding warnings to [] at the embed boundary
for:

- embed()
- embedMany() single-call path
- embedMany() chunked path

## Tests

- pnpm --dir packages/ai exec vitest --config vitest.node.config.js
--run src/embed/embed.test.ts src/embed/embed-many.test.ts
- pnpm --dir packages/ai exec vitest --config vitest.edge.config.js
--run src/embed/embed.test.ts src/embed/embed-many.test.ts
- pnpm --filter ai type-check
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

embed() and embedMany() crash with EmbeddingModelV2 providers that omit warnings

3 participants