remotion-dev/remotion · error
assetPath must be a non-empty public-folder path, or an asse
Error message
assetPath must be a non-empty public-folder path, or an asset must be selected in Studio.
What it means
The WebMcp asset tool resolves the asset path from the explicit assetPath argument or the currently selected Studio content. If neither yields a non-empty string, it throws because it cannot determine which public-folder asset to operate on.
Source
Thrown at packages/studio/src/components/WebMcp.tsx:176
assetPath,
currentContent,
staticFiles,
}: {
readonly assetPath: unknown;
readonly currentContent: {
readonly asset?: string;
readonly type: string;
} | null;
readonly staticFiles: readonly {readonly name: string}[];
}) => {
const resolvedAssetPath =
assetPath === undefined
? currentContent?.type === 'asset'
? (currentContent.asset ?? null)
: null
: assetPath;
if (typeof resolvedAssetPath !== 'string' || resolvedAssetPath.length === 0) {
throw new Error(
'assetPath must be a non-empty public-folder path, or an asset must be selected in Studio.',
);
}
if (!staticFiles.some((file) => file.name === resolvedAssetPath)) {
throw new Error(`Asset ${resolvedAssetPath} was not found in public/.`);
}
return resolvedAssetPath;
};
export const WebMcp: FC = () => {
const {addCaptionJob, addVideoMattingJob} = useContext(RenderQueueContext);
const staticFiles = useStaticFiles();
const {canSelect, clearSelection, selectedItems, selectItems} =
useTimelineSelection();
const {canvasContent, compositions, currentCompositionMetadata, folders} =
useContext(Internals.CompositionManager);View on GitHub (pinned to b2f4e34732)
Solutions
- Pass an explicit non-empty assetPath pointing at a file in public/ (e.g. 'audio/voice.mp3').
- Select the desired asset in Remotion Studio before invoking the tool.
- Double-check the argument spelling — assetPath, not src or path.
- List static files first to pick a valid public-folder path.
Example fix
// before
await tool.execute({}); // no selection
// after
await tool.execute({assetPath: 'audio/voice.mp3'}); Defensive patterns
Strategy: type-guard
Validate before calling
if (typeof assetPath !== 'string' || assetPath.length === 0) {
throw new Error('assetPath is required when no asset is selected.');
} Type guard
const hasAssetPath = (a: unknown): a is string => typeof a === 'string' && a.length > 0;
Try / catch
try {
const p = resolveAssetPath(input);
} catch (e) {
if (e.message.includes('assetPath must be a non-empty')) {
return 'No asset selected — pass assetPath explicitly.';
}
} Prevention
- Always pass assetPath explicitly from tooling.
- Select an asset in Studio before invoking selection-less calls.
- Validate non-empty string inputs before tool calls.
When it happens
Trigger: Calling the WebMcp asset tool with assetPath omitted while no asset is selected in Studio, or passing assetPath: '' / non-string.
Common situations: MCP agent calls the tool without arguments expecting the selection to provide context; Studio opened without selecting an asset; a script sending an empty string path.
Understand the failure class
Background: "missing required argument" and "the following required arguments were not provided": what required-argument errors mean and how to fix them — this error's family across 20 libraries.
Related errors
- The artifact filename ${artifact.filename} was emitted more
- Composition ${compositionName} not found.
- visible must be a boolean.
- frame must be an integer.
- Studio server port should be a number. Got ${typeof port} ($
AI-assisted analysis of remotion-dev/remotion@b2f4e34732 (2026-09-09).
Data as JSON: /api/errors/ff37d4c99fbe891d.
Report an issue: GitHub.