{"record":{"id":"1e7803fcd3569405","repo":"linshenkx/prompt-optimizer","slug":"unsupported-test-type-1e7803","errorCode":"UNSUPPORTED_TEST_TYPE","errorMessage":"UNSUPPORTED_TEST_TYPE","messagePattern":"UNSUPPORTED_TEST_TYPE","errorType":"error_code","errorClass":"ImageError","httpStatus":null,"severity":"warning","filePath":"packages/core/src/services/image/adapters/openai.ts","lineNumber":157,"sourceCode":"    if (testType === 'text2image') {\n      return {\n        prompt: 'a simple red flower',\n        count: 1\n      }\n    }\n\n    if (testType === 'image2image') {\n      return {\n        prompt: 'make this image more colorful',\n        inputImage: {\n          b64: AbstractImageProviderAdapter.TEST_IMAGE_BASE64.split(',')[1], // 去除data URL前缀\n          mimeType: 'image/png'\n        },\n        count: 1\n      }\n    }\n\n    throw new ImageError(IMAGE_ERROR_CODES.UNSUPPORTED_TEST_TYPE, undefined, { testType })\n  }\n\n  protected getParameterDefinitions(_modelId: string): readonly ImageParameterDefinition[] {\n    // GPT Image 2 使用统一的参数定义，n参数固定为1不暴露给用户\n    return [\n      {\n        name: 'size',\n        labelKey: 'image.params.size.label',\n        descriptionKey: 'image.params.size.description',\n        type: 'string',\n        defaultValue: '1024x1024',\n        allowedValues: [...GPT_IMAGE_2_SIZE_VALUES]\n      },\n      {\n        name: 'quality',\n        labelKey: 'image.params.quality.label',\n        descriptionKey: 'image.params.quality.description',\n        type: 'string',","sourceCodeStart":139,"sourceCodeEnd":175,"githubUrl":"https://github.com/linshenkx/prompt-optimizer/blob/3e677b1d9f7e0493c142c175560531e7ae786dce/packages/core/src/services/image/adapters/openai.ts#L139-L175","documentation":"The OpenAI image adapter's getTestImageRequest supports specific test types; any other testType throws UNSUPPORTED_TEST_TYPE with the offending value in metadata, following the shared adapter pattern.","triggerScenarios":"Requesting a test image request type the OpenAI adapter doesn't implement — e.g. a test type for a capability GPT Image models don't expose or one added generically by the test harness.","commonSituations":"Test-runner enumerations passing unsupported types to every adapter; new test types introduced for other providers without an OpenAI implementation.","solutions":["Use the supported test types for OpenAI image models","Filter test options by adapter capability before invoking","Implement the missing test type in the adapter if genuinely needed"],"exampleFix":null,"handlingStrategy":"validation","validationCode":"const OPENAI_TESTS = new Set(['text2image' /* supported types */])\nif (!OPENAI_TESTS.has(testType)) skip()","typeGuard":"function openaiSupportsTest(t: string): boolean { return OPENAI_TESTS.has(t) }","tryCatchPattern":"if (!openaiSupportsTest(testType)) return\nawait adapter.getTestImageRequest(testType)","preventionTips":["Drive test options from per-adapter capability lists","Treat UNSUPPORTED_TEST_TYPE as skip rather than error"],"tags":["openai","test","unsupported-operation"],"backgroundTag":"unsupported-operation-parameter","analyzedSha":"3e677b1d9f7e0493c142c175560531e7ae786dce","analyzedAt":"2026-08-27T21:29:16.709Z","schemaVersion":2},"datasetVersion":"2026-08-28T00:17:15.603Z"}