linshenkx/prompt-optimizer · warning · ImageError
UNSUPPORTED_TEST_TYPE
UNSUPPORTED_TEST_TYPE
Error message
UNSUPPORTED_TEST_TYPE
What it means
The ModelScope adapter's getTestImageRequest only supports specific test types (e.g. simple t2i prompts). When asked for a test request of an unrecognized testType, it throws UNSUPPORTED_TEST_TYPE with the offending testType in metadata.
Source
Thrown at packages/core/src/services/image/adapters/modelscope.ts:108
labelKey: 'image.params.count.label',
descriptionKey: 'image.params.count.description',
type: 'integer',
defaultValue: 1,
minValue: 1,
maxValue: 4
}
]
}
protected getTestImageRequest(testType: 'text2image' | 'image2image'): Omit<ImageRequest, 'configId'> {
if (testType === 'text2image') {
return {
prompt: '一朵简单的红色花朵',
count: 1
}
}
throw new ImageError(IMAGE_ERROR_CODES.UNSUPPORTED_TEST_TYPE, undefined, { testType })
}
protected getParameterDefinitions(_modelId: string): readonly ImageParameterDefinition[] {
return this.getDefaultParameterDefinitions()
}
protected getDefaultParameterValues(_modelId: string): Record<string, unknown> {
return {
size: '1024x1024',
n: 1
}
}
protected async doGenerate(request: ImageRequest, config: ImageModelConfig): Promise<ImageResult> {
// ModelScope 适配器仅支持文生图
if (request.inputImage) {
throw new ImageError(IMAGE_ERROR_CODES.MODEL_NOT_SUPPORT_IMAGE2IMAGE, undefined, { modelName: config.modelId })
}View on GitHub (pinned to 3e677b1d9f)
Solutions
- Pass one of the supported test types (text-to-image) for ModelScope models
- Guard the test call with a capability check before requesting the test
- File an adapter feature request if i2i testing is needed
Defensive patterns
Strategy: validation
Validate before calling
const SUPPORTED = new Set(['text2image' /* adapter's supported types */]) if (!SUPPORTED.has(testType)) skipTest(modelScopeModel)
Type guard
function isSupportedTestType(t: string): boolean { return ['text2image'].includes(t) } Try / catch
if (!isSupportedTestType(testType)) return { skipped: true }
await adapter.getTestImageRequest(testType) Prevention
- Gate test types per provider in the UI
- Treat UNSUPPORTED_TEST_TYPE as skip, not failure
When it happens
Trigger: Invoking the adapter's model-test feature with a testType other than the supported values — e.g. a UI-driven 'image2image' or 'edit' connectivity test on a ModelScope image model.
Common situations: A generic test-runner UI that enumerates all test types across adapters and passes unsupported ones to ModelScope; new test types added elsewhere but not implemented here.
Related errors
- UNSUPPORTED_TEST_TYPE
- UNSUPPORTED_TEST_TYPE
- UNSUPPORTED_TEST_TYPE
- MODEL_NOT_SUPPORT_IMAGE2IMAGE
- GENERATION_FAILED
AI-assisted analysis of linshenkx/prompt-optimizer@3e677b1d9f (2026-08-27).
Data as JSON: /api/errors/d3d89d7f95349e1f.
Report an issue: GitHub.