{"record":{"id":"4b8586c8f9b47e6e","repo":"musistudio/claude-code-router","slug":"resolution-must-be-one-of-constraints-resolution","errorCode":null,"errorMessage":"resolution must be one of ${constraints.resolutions.join(\", \")} for ${target.protocol}.","messagePattern":"resolution must be one of (.+?) for (.+?)\\.","errorType":"validation","errorClass":"Error","httpStatus":null,"severity":"error","filePath":"packages/core/src/media/service.ts","lineNumber":166,"sourceCode":"\n  videoStart(args: Record<string, unknown>, modelInput: MediaModelInput): PublicMediaJob {\n    const modelPlan = this.mediaModelPlan(\"video-generate\", modelInput);\n    const target = resolveProviderMediaTarget(this.requireConfig(), modelPlan.modelSelector, \"video-generate\");\n    const constraints = videoGenerationConstraints(target.protocol);\n    const durationValue = numberValue(args.duration) ?? constraints.defaultDuration;\n    if (durationValue === undefined) throw new Error(`duration is required for ${target.protocol}.`);\n    if (!Number.isInteger(durationValue)) throw new Error(\"duration must be an integer number of seconds.\");\n    if (constraints.durations && !constraints.durations.includes(durationValue)) {\n      throw new Error(`duration must be one of ${constraints.durations.join(\", \")} seconds for ${target.protocol}.`);\n    }\n    if (constraints.durationMinimum !== undefined && constraints.durationMaximum !== undefined &&\n      (durationValue < constraints.durationMinimum || durationValue > constraints.durationMaximum)) {\n      throw new Error(`duration must be between ${constraints.durationMinimum} and ${constraints.durationMaximum} seconds for ${target.protocol}.`);\n    }\n    const resolution = optionalString(args.resolution) ?? constraints.defaultResolution;\n    if (!resolution) throw new Error(`resolution is required for ${target.protocol}.`);\n    if (!constraints.resolutions.includes(resolution)) {\n      throw new Error(`resolution must be one of ${constraints.resolutions.join(\", \")} for ${target.protocol}.`);\n    }\n    const aspectRatio = optionalString(args.aspect_ratio);\n    if (constraints.requiredParameters.includes(\"aspect_ratio\") && !aspectRatio) {\n      throw new Error(`aspect_ratio is required for ${target.protocol}.`);\n    }\n    if (aspectRatio && !constraints.aspectRatios.includes(aspectRatio)) {\n      throw new Error(`aspect_ratio must be one of ${constraints.aspectRatios.join(\", \")} for ${target.protocol}.`);\n    }\n    const request: VideoGenerateRequest = {\n      aspectRatio,\n      duration: durationValue,\n      images: args.images === undefined && args.image === undefined ? [] : this.validateImages(args.images ?? args.image, 1, 7),\n      prompt: requiredPrompt(args.prompt),\n      resolution\n    };\n    const job = this.submit(\"video-generate\", request, modelPlan, optionalString(args.idempotency_key));\n    return this.publicJob(job);\n  }","sourceCodeStart":148,"sourceCodeEnd":184,"githubUrl":"https://github.com/musistudio/claude-code-router/blob/99f24806c6a2c660b16e53e95211c517448a6c90/packages/core/src/media/service.ts#L148-L184","documentation":"Thrown when the supplied resolution is not in the protocol's allowed resolutions list. The message lists the accepted values so the fix is usually immediate.","triggerScenarios":"Passing e.g. resolution: \"4k\" for a protocol whose constraints.resolutions only includes [\"480p\",\"720p\",\"1080p\"].","commonSituations":"Hardcoded resolution strings from other providers (\"1920x1080\" vs \"1080p\"); user free-text resolution input; uppercase/case-mismatched values.","solutions":["Use one of the exact values listed in the error message","Populate your picker from videoGenerationConstraints(protocol).resolutions","Normalize/case-fold user input against the allowlist before calling"],"exampleFix":"// before\nmedia.videoStart({ prompt, resolution: \"1920x1080\" }, modelInput);\n\n// after\nmedia.videoStart({ prompt, resolution: \"1080p\" }, modelInput);","handlingStrategy":"validation","validationCode":"const c = videoGenerationConstraints(protocol);\nif (!c.resolutions.includes(resolution)) {\n  throw new Error(`Allowed: ${c.resolutions.join(\", \")}`);\n}","typeGuard":"const isAllowedResolution = (r: string, c: VideoConstraints): boolean =>\n  c.resolutions.includes(r);","tryCatchPattern":null,"preventionTips":["Use exact provider vocabulary (e.g. \"1080p\")","Populate selects from constraints.resolutions"],"tags":["media","video","validation","allowed-values"],"backgroundTag":"parameter-validation-failed","analyzedSha":"99f24806c6a2c660b16e53e95211c517448a6c90","analyzedAt":"2026-08-27T04:11:01.184Z","schemaVersion":2},"datasetVersion":"2026-08-27T08:17:20.692Z"}