Skip to content

fix(harness): use mediaType instead of mimeType in sendMessage file parts#13833

Merged
abhiaiyer91 merged 1 commit into
mastra-ai:mainfrom
superset-sh:fix/harness-file-mediatype
Mar 5, 2026
Merged

fix(harness): use mediaType instead of mimeType in sendMessage file parts#13833
abhiaiyer91 merged 1 commit into
mastra-ai:mainfrom
superset-sh:fix/harness-file-mediatype

Conversation

@saddlepaddle
Copy link
Copy Markdown
Contributor

@saddlepaddle saddlepaddle commented Mar 5, 2026

Summary

Fixes a typo in Harness.sendMessage() where file parts were constructed with mimeType instead of mediaType. This caused file attachments to be routed through the V4 adapter instead of V5, preventing them from being correctly processed by AI SDK v5 providers.

Change

packages/core/src/harness/harness.ts

- return { type: 'file' as const, data: f.data, mimeType: f.mediaType, filename: f.filename };
+ return { type: 'file' as const, data: f.data, mediaType: f.mediaType, filename: f.filename };

Context

The files parameter was added in #13574, but the file part construction used mimeType (V4 format) instead of mediaType (V5 format). The AI SDK v5 FilePart type expects mediaType, so using mimeType causes the part to not match the expected shape and fall through to the legacy adapter path.

This bug is present in @mastra/core@1.9.0 on npm.

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Corrected file attachment metadata naming in the message system to ensure files are properly routed and processed by supported AI SDK providers.

…arts

The file part object passed `mimeType` instead of `mediaType`, causing
file attachments to be routed through the V4 adapter instead of V5.

Introduced in mastra-ai#13574.
@vercel
Copy link
Copy Markdown

vercel Bot commented Mar 5, 2026

@saddlepaddle is attempting to deploy a commit to the Mastra Team on Vercel.

A member of the Team first needs to authorize it.

@changeset-bot
Copy link
Copy Markdown

changeset-bot Bot commented Mar 5, 2026

🦋 Changeset detected

Latest commit: d2d05d0

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 21 packages
Name Type
@mastra/core Patch
mastracode Patch
@mastra/mcp-docs-server Patch
@internal/playground Patch
@mastra/client-js Patch
@mastra/opencode Patch
@mastra/longmemeval Patch
mastra Patch
@mastra/deployer-cloud Patch
@mastra/deployer-vercel Patch
@mastra/playground-ui Patch
@mastra/react Patch
@mastra/server Patch
@mastra/deployer Patch
create-mastra Patch
@mastra/express Patch
@mastra/fastify Patch
@mastra/hono Patch
@mastra/koa Patch
@mastra/deployer-cloudflare Patch
@mastra/deployer-netlify Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@coderabbitai
Copy link
Copy Markdown
Contributor

coderabbitai Bot commented Mar 5, 2026

Walkthrough

Fixes file attachment handling in the harness by renaming the mimeType property to mediaType in the sendMessage method to ensure compatibility with the V5 adapter and AI SDK v5 providers.

Changes

Cohort / File(s) Summary
Changeset
.changeset/fix-harness-file-mediatype.md
Adds release note documenting the patch fix for mimeType to mediaType property rename in file part construction.
Core Harness
packages/core/src/harness/harness.ts
Renames mimeType property to mediaType in file part object within sendMessage method. Public API change affecting file attachment shape.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly and concisely describes the main change: fixing the incorrect property name from mimeType to mediaType in the sendMessage file parts, which aligns perfectly with the changeset.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link
Copy Markdown
Contributor

@coderabbitai coderabbitai Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In @.changeset/fix-harness-file-mediatype.md:
- Line 5: Rewrite line 5 to an outcome-first, action-verb phrasing that
emphasizes user impact: e.g., "Fixed file attachments being routed to the wrong
adapter by correcting a typo from `mimeType` to `mediaType` in the `sendMessage`
file part construction, ensuring attachments are processed by AI SDK v5
providers." Reference the `sendMessage` change (typo `mimeType` → `mediaType`)
and the resulting fix for V4→V5 adapter routing in the message.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: d164fe14-9dda-4331-a8a2-6ab0943fd890

📥 Commits

Reviewing files that changed from the base of the PR and between 9bf3a0d and d2d05d0.

📒 Files selected for processing (2)
  • .changeset/fix-harness-file-mediatype.md
  • packages/core/src/harness/harness.ts

'@mastra/core': patch
---

Fix `mimeType` → `mediaType` typo in `sendMessage` file part construction. This caused file attachments to be routed through the V4 adapter instead of V5, preventing them from being correctly processed by AI SDK v5 providers.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Use an outcome-first, action-verb phrasing in the changeset.

Line 5 is accurate, but it reads implementation-heavy. Please rewrite with a direct user-impact statement and start with an action verb like “Fixed.”

✏️ Suggested wording
-Fix `mimeType` → `mediaType` typo in `sendMessage` file part construction. This caused file attachments to be routed through the V4 adapter instead of V5, preventing them from being correctly processed by AI SDK v5 providers.
+Fixed file attachments in `sendMessage` by using `mediaType`. Attachments are now handled correctly by AI SDK v5 providers.

potential_issue
As per coding guidelines: "Use action-oriented verbs (Added, Fixed, Improved...)" and "Highlight outcomes... Do not focus on internal implementation details."

📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
Fix `mimeType``mediaType` typo in `sendMessage` file part construction. This caused file attachments to be routed through the V4 adapter instead of V5, preventing them from being correctly processed by AI SDK v5 providers.
Fixed file attachments in `sendMessage` by using `mediaType`. Attachments are now handled correctly by AI SDK v5 providers.
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In @.changeset/fix-harness-file-mediatype.md at line 5, Rewrite line 5 to an
outcome-first, action-verb phrasing that emphasizes user impact: e.g., "Fixed
file attachments being routed to the wrong adapter by correcting a typo from
`mimeType` to `mediaType` in the `sendMessage` file part construction, ensuring
attachments are processed by AI SDK v5 providers." Reference the `sendMessage`
change (typo `mimeType` → `mediaType`) and the resulting fix for V4→V5 adapter
routing in the message.

@abhiaiyer91 abhiaiyer91 merged commit f993c38 into mastra-ai:main Mar 5, 2026
10 of 18 checks passed
graysonhicks pushed a commit that referenced this pull request Mar 5, 2026
…arts (#13833)

## Summary

Fixes a typo in `Harness.sendMessage()` where file parts were
constructed with `mimeType` instead of `mediaType`. This caused file
attachments to be routed through the V4 adapter instead of V5,
preventing them from being correctly processed by AI SDK v5 providers.

## Change

**`packages/core/src/harness/harness.ts`**

```diff
- return { type: 'file' as const, data: f.data, mimeType: f.mediaType, filename: f.filename };
+ return { type: 'file' as const, data: f.data, mediaType: f.mediaType, filename: f.filename };
```

## Context

The `files` parameter was added in #13574, but the file part
construction used `mimeType` (V4 format) instead of `mediaType` (V5
format). The AI SDK v5 `FilePart` type expects `mediaType`, so using
`mimeType` causes the part to not match the expected shape and fall
through to the legacy adapter path.

This bug is present in `@mastra/core@1.9.0` on npm.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

* **Bug Fixes**
* Corrected file attachment metadata naming in the message system to
ensure files are properly routed and processed by supported AI SDK
providers.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
wardpeet pushed a commit that referenced this pull request Mar 9, 2026
…arts (#13833)

## Summary

Fixes a typo in `Harness.sendMessage()` where file parts were
constructed with `mimeType` instead of `mediaType`. This caused file
attachments to be routed through the V4 adapter instead of V5,
preventing them from being correctly processed by AI SDK v5 providers.

## Change

**`packages/core/src/harness/harness.ts`**

```diff
- return { type: 'file' as const, data: f.data, mimeType: f.mediaType, filename: f.filename };
+ return { type: 'file' as const, data: f.data, mediaType: f.mediaType, filename: f.filename };
```

## Context

The `files` parameter was added in #13574, but the file part
construction used `mimeType` (V4 format) instead of `mediaType` (V5
format). The AI SDK v5 `FilePart` type expects `mediaType`, so using
`mimeType` causes the part to not match the expected shape and fall
through to the legacy adapter path.

This bug is present in `@mastra/core@1.9.0` on npm.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->

## Summary by CodeRabbit

## Release Notes

* **Bug Fixes**
* Corrected file attachment metadata naming in the message system to
ensure files are properly routed and processed by supported AI SDK
providers.

<!-- end of auto-generated comment: release notes by coderabbit.ai -->
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants