{"record":{"id":"2cdc94e760473ad6","repo":"diegosouzapw/OmniRoute","slug":"paid-model-target-blocked","errorCode":"PAID_MODEL_TARGET_BLOCKED","errorMessage":"This field cannot target a paid-only model while 'Hide paid models' is enabled.","messagePattern":"This field cannot target a paid-only model while 'Hide paid models' is enabled\\.","errorType":"http","errorClass":null,"httpStatus":400,"severity":"error","filePath":"src/app/api/settings/background-degradation/route.ts","lineNumber":79,"sourceCode":"          details: [{ field: \"body\", message: \"Invalid JSON body\" }],\n        },\n      },\n      { status: 400 }\n    );\n  }\n\n  try {\n    const validation = validateBody(jsonObjectSchema, rawBody);\n    if (isValidationFailure(validation)) {\n      return NextResponse.json({ error: validation.error }, { status: 400 });\n    }\n    const config = validation.data as { degradationMap?: Record<string, string> };\n\n    if (await hasBlockedPaidTarget(config.degradationMap)) {\n      return NextResponse.json(\n        {\n          error: {\n            code: \"PAID_MODEL_TARGET_BLOCKED\",\n            message:\n              \"This field cannot target a paid-only model while 'Hide paid models' is enabled.\",\n          },\n        },\n        { status: 400 }\n      );\n    }\n\n    setBackgroundDegradationConfig(config);\n\n    // Persist to database (excluding stats)\n    const { stats, ...persistable } = getBackgroundDegradationConfig();\n    await updateSettings({ backgroundDegradation: persistable });\n\n    return NextResponse.json({ success: true, ...getBackgroundDegradationConfig() });\n  } catch (error) {\n    console.error(\"[API ERROR] /api/settings/background-degradation PUT:\", error);\n    return NextResponse.json({ error: \"Failed to update config\" }, { status: 500 });","sourceCodeStart":61,"sourceCodeEnd":97,"githubUrl":"https://github.com/diegosouzapw/OmniRoute/blob/a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d/src/app/api/settings/background-degradation/route.ts#L61-L97","documentation":"Error \"This field cannot target a paid-only model while 'Hide paid models' is enabled.\" thrown in diegosouzapw/OmniRoute.","triggerScenarios":"Thrown at src/app/api/settings/background-degradation/route.ts:79 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":[],"exampleFix":null,"handlingStrategy":null,"validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"a179ffed5bb2e0b883b9ae7214ce8717b2a94c4d","analyzedAt":"2026-08-25T18:35:09.898Z","schemaVersion":2},"datasetVersion":"2026-08-25T21:54:21.419Z"}