musistudio/claude-code-router · error · Error
resolution is required for ${target.protocol}.
Error message
resolution is required for ${target.protocol}. What it means
Thrown when no resolution can be determined for video generation: args.resolution is absent and the protocol's constraints define no defaultResolution. Unlike duration/resolution mistakes with wrong values, this is the missing-value case.
Source
Thrown at packages/core/src/media/service.ts:164
return this.submitAndWait("image-edit", request, modelPlan, optionalString(args.idempotency_key));
}
videoStart(args: Record<string, unknown>, modelInput: MediaModelInput): PublicMediaJob {
const modelPlan = this.mediaModelPlan("video-generate", modelInput);
const target = resolveProviderMediaTarget(this.requireConfig(), modelPlan.modelSelector, "video-generate");
const constraints = videoGenerationConstraints(target.protocol);
const durationValue = numberValue(args.duration) ?? constraints.defaultDuration;
if (durationValue === undefined) throw new Error(`duration is required for ${target.protocol}.`);
if (!Number.isInteger(durationValue)) throw new Error("duration must be an integer number of seconds.");
if (constraints.durations && !constraints.durations.includes(durationValue)) {
throw new Error(`duration must be one of ${constraints.durations.join(", ")} seconds for ${target.protocol}.`);
}
if (constraints.durationMinimum !== undefined && constraints.durationMaximum !== undefined &&
(durationValue < constraints.durationMinimum || durationValue > constraints.durationMaximum)) {
throw new Error(`duration must be between ${constraints.durationMinimum} and ${constraints.durationMaximum} seconds for ${target.protocol}.`);
}
const resolution = optionalString(args.resolution) ?? constraints.defaultResolution;
if (!resolution) throw new Error(`resolution is required for ${target.protocol}.`);
if (!constraints.resolutions.includes(resolution)) {
throw new Error(`resolution must be one of ${constraints.resolutions.join(", ")} for ${target.protocol}.`);
}
const aspectRatio = optionalString(args.aspect_ratio);
if (constraints.requiredParameters.includes("aspect_ratio") && !aspectRatio) {
throw new Error(`aspect_ratio is required for ${target.protocol}.`);
}
if (aspectRatio && !constraints.aspectRatios.includes(aspectRatio)) {
throw new Error(`aspect_ratio must be one of ${constraints.aspectRatios.join(", ")} for ${target.protocol}.`);
}
const request: VideoGenerateRequest = {
aspectRatio,
duration: durationValue,
images: args.images === undefined && args.image === undefined ? [] : this.validateImages(args.images ?? args.image, 1, 7),
prompt: requiredPrompt(args.prompt),
resolution
};
const job = this.submit("video-generate", request, modelPlan, optionalString(args.idempotency_key));View on GitHub (pinned to 99f24806c6)
Solutions
- Pass resolution explicitly: videoStart({ resolution: "720p", ... })
- Check constraints.resolutions (surfaced in error 216's message) for allowed values
- Confirm target.protocol matches the provider you configured
Example fix
// before
media.videoStart({ prompt, duration: 5 }, modelInput);
// after
media.videoStart({ prompt, duration: 5, resolution: "720p" }, modelInput); Defensive patterns
Strategy: validation
Validate before calling
const c = videoGenerationConstraints(protocol);
const resolution = args.resolution ?? c.defaultResolution;
if (!resolution) throw new Error(`resolution required for ${protocol}`); Type guard
const isValidResolution = (r: unknown): r is string => typeof r === "string" && r.length > 0;
Prevention
- Always pass resolution explicitly when switching providers
- Confirm the resolved protocol before relying on defaults
When it happens
Trigger: Starting video generation on a protocol with no defaultResolution and omitting the resolution argument.
Common situations: Provider switch removing the default; minimal args relying on old defaults; resolution passed under a different key name (e.g. res or size).
Understand the failure class
Background: Missing required parameter errors: what 'X is required' and 'the required X param is missing' mean, and how to fix them — this error's family across 27 libraries.
Related errors
- duration is required for ${target.protocol}.
- duration must be an integer number of seconds.
- duration must be one of ${constraints.durations.join(", ")}
- duration must be between ${constraints.durationMinimum} and
- resolution must be one of ${constraints.resolutions.join(",
AI-assisted analysis of musistudio/claude-code-router@99f24806c6 (2026-08-27).
Data as JSON: /api/errors/f2977d2319fca043.
Report an issue: GitHub.